Class DefaultGridLook
java.lang.Object
org.eclipse.nebula.paperclips.core.grid.DefaultGridLook
- All Implemented Interfaces:
GridLook
public class DefaultGridLook extends java.lang.Object implements GridLook
A GridLook which draws a border around grid cells, with configurable
background colors for body, header, and footer cells.
-
Field Summary
Fields Modifier and Type Field Description (package private) CellBackgroundProvider
bodyBackgroundProvider
static int
BORDER_OVERLAP
Constant cell spacing value indicating that the borders of adjacent cells should overlap so the appear continuous.(package private) Border
cellBorder
(package private) org.eclipse.swt.graphics.Rectangle
cellPadding
(package private) org.eclipse.swt.graphics.Point
cellSpacing
(package private) DefaultCellBackgroundProvider
defaultBodyBackgroundProvider
(package private) DefaultCellBackgroundProvider
defaultFooterBackgroundProvider
(package private) DefaultCellBackgroundProvider
defaultHeaderBackgroundProvider
(package private) CellBackgroundProvider
footerBackgroundProvider
(package private) int
footerGap
(package private) CellBackgroundProvider
headerBackgroundProvider
(package private) int
headerGap
-
Constructor Summary
Constructors Constructor Description DefaultGridLook()
Constructs a DefaultGridLook with no border, no cell spacing, and no background colors.DefaultGridLook(int horizontalSpacing, int verticalSpacing)
Constructs a DefaultGridLook with the given cell spacing, and no border or background colors. -
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object obj)
org.eclipse.swt.graphics.RGB
getBodyBackground()
Returns the body background color.CellBackgroundProvider
getBodyBackgroundProvider()
Returns the body background color provider.Border
getCellBorder()
Returns the cell border.org.eclipse.swt.graphics.Rectangle
getCellPadding()
Returns a rectangle whose public fields denote the left (x), top (y), right (width) and bottom (height) cell padding, expressed in points. 72 points = 1" = 2.54cm.org.eclipse.swt.graphics.Point
getCellSpacing()
Returns the border spacing, in points, between adjacent grid cells.org.eclipse.swt.graphics.RGB
getFooterBackground()
Returns the footer background color.CellBackgroundProvider
getFooterBackgroundProvider()
Returns the footer background color provider.int
getFooterGap()
Returns the vertical gap between the body and footer cells.org.eclipse.swt.graphics.RGB
getHeaderBackground()
Returns the header background color.CellBackgroundProvider
getHeaderBackgroundProvider()
Returns the header background color provider.int
getHeaderGap()
Returns the vertical gap between the header and body cells.GridLookPainter
getPainter(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc)
Returns a GridLookPainter for painting the GridLook.int
hashCode()
void
setBodyBackground(org.eclipse.swt.graphics.RGB bodyBackground)
Sets the body background color.void
setBodyBackgroundProvider(CellBackgroundProvider bodyBackgroundProvider)
Sets the body background color provider.void
setCellBorder(Border border)
Sets the cell border.void
setCellPadding(int horizontalPadding, int verticalPadding)
Sets the cell padding to the given horizontal and vertical values.void
setCellPadding(int left, int top, int right, int bottom)
Sets the cell padding to the specified values.void
setCellPadding(org.eclipse.swt.graphics.Rectangle cellPadding)
Sets the cell padding to the values in the public fields of the argument.void
setCellSpacing(int horizontal, int vertical)
Sets the border spacing, in points, between adjacent grid cells.void
setCellSpacing(org.eclipse.swt.graphics.Point cellSpacing)
Sets the border spacing, in points, between adjacent grid cells.void
setFooterBackground(org.eclipse.swt.graphics.RGB footerBackground)
Sets the footer background color.void
setFooterBackgroundProvider(CellBackgroundProvider footerBackgroundProvider)
Sets the footer background color provider.void
setFooterGap(int footerGap)
Sets the vertical gap between the header and body cells.void
setHeaderBackground(org.eclipse.swt.graphics.RGB headerBackground)
Sets the header background color.void
setHeaderBackgroundProvider(CellBackgroundProvider headerBackgroundProvider)
Sets the header background color provider.void
setHeaderGap(int headerGap)
Sets the vertical gap between the header and body cells.
-
Field Details
-
BORDER_OVERLAP
public static final int BORDER_OVERLAPConstant cell spacing value indicating that the borders of adjacent cells should overlap so the appear continuous.- See Also:
- Constant Field Values
-
cellSpacing
org.eclipse.swt.graphics.Point cellSpacing -
cellPadding
org.eclipse.swt.graphics.Rectangle cellPadding -
headerGap
int headerGap -
footerGap
int footerGap -
cellBorder
Border cellBorder -
defaultBodyBackgroundProvider
DefaultCellBackgroundProvider defaultBodyBackgroundProvider -
defaultHeaderBackgroundProvider
DefaultCellBackgroundProvider defaultHeaderBackgroundProvider -
defaultFooterBackgroundProvider
DefaultCellBackgroundProvider defaultFooterBackgroundProvider -
bodyBackgroundProvider
CellBackgroundProvider bodyBackgroundProvider -
headerBackgroundProvider
CellBackgroundProvider headerBackgroundProvider -
footerBackgroundProvider
CellBackgroundProvider footerBackgroundProvider
-
-
Constructor Details
-
DefaultGridLook
public DefaultGridLook()Constructs a DefaultGridLook with no border, no cell spacing, and no background colors. -
DefaultGridLook
public DefaultGridLook(int horizontalSpacing, int verticalSpacing)Constructs a DefaultGridLook with the given cell spacing, and no border or background colors.- Parameters:
horizontalSpacing
- the horizontal cell spacing.verticalSpacing
- the vertical cell spacing.
-
-
Method Details
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-
getCellBorder
Returns the cell border. Default is an empty border with no margins.- Returns:
- the cell border.
-
setCellBorder
Sets the cell border.- Parameters:
border
- the cell border.
-
getCellSpacing
public org.eclipse.swt.graphics.Point getCellSpacing()Returns the border spacing, in points, between adjacent grid cells. Default is (x=BORDER_OVERLAP, y=BORDER_OVERLAP).- Returns:
- the border spacing, in points, between adjacent grid cells.
-
setCellSpacing
public void setCellSpacing(org.eclipse.swt.graphics.Point cellSpacing)Sets the border spacing, in points, between adjacent grid cells. A value ofBORDER_OVERLAP
causes the borders to overlap, making the border appear continuous throughout the grid. A value of 0 or more causes the cell borders to be spaced that many points apart. 72 points = 1".- Parameters:
cellSpacing
- a point whose x and y elements indicate the horizontal and vertical spacing between grid cells.
-
setCellSpacing
public void setCellSpacing(int horizontal, int vertical)Sets the border spacing, in points, between adjacent grid cells. A value ofBORDER_OVERLAP
causes the borders to overlap, making the border appear continuous throughout the grid. A value of 0 or more causes the cell borders to be spaced that many points apart. 72 points = 1".- Parameters:
horizontal
- the horizontal cell spacing.vertical
- the vertical cell spacing.
-
getCellPadding
public org.eclipse.swt.graphics.Rectangle getCellPadding()Returns a rectangle whose public fields denote the left (x), top (y), right (width) and bottom (height) cell padding, expressed in points. 72 points = 1" = 2.54cm.- Returns:
- a rectangle whose public fields denote the cell padding at each edge.
-
setCellPadding
public void setCellPadding(org.eclipse.swt.graphics.Rectangle cellPadding)Sets the cell padding to the values in the public fields of the argument.- Parameters:
cellPadding
- the new cell padding.
-
setCellPadding
public void setCellPadding(int horizontalPadding, int verticalPadding)Sets the cell padding to the given horizontal and vertical values. This is equivalent to calling setCellPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding).- Parameters:
horizontalPadding
- the amount of padding to add to the left and right of each cell, in points.verticalPadding
- the amount padding to add to the top and bottom each cell, in points.
-
setCellPadding
public void setCellPadding(int left, int top, int right, int bottom)Sets the cell padding to the specified values.- Parameters:
left
- the left cell padding, in points.top
- the top cell padding, in points.right
- the right cell padding, in points.bottom
- the bottom cell padding, in points.
-
getHeaderBackground
public org.eclipse.swt.graphics.RGB getHeaderBackground()Returns the header background color. If null, the body background color is used. Default is null.- Returns:
- the header background color.
-
setHeaderBackground
public void setHeaderBackground(org.eclipse.swt.graphics.RGB headerBackground)Sets the header background color. Calls to this method override any previous calls to setHeaderBackgroundProvider(...).- Parameters:
headerBackground
- the new background color. If null, the body background color will be used.
-
getHeaderBackgroundProvider
Returns the header background color provider.- Returns:
- the header background color provider.
-
setHeaderBackgroundProvider
Sets the header background color provider. Calls to this method override any previous calls to setHeaderBackground(RGB). Setting this property to null restores the default background provider.- Parameters:
headerBackgroundProvider
- the new background color provider.
-
getHeaderGap
public int getHeaderGap()Returns the vertical gap between the header and body cells. Default is BORDER_OVERLAP.- Returns:
- the vertical gap between the header and body cells.
-
setHeaderGap
public void setHeaderGap(int headerGap)Sets the vertical gap between the header and body cells. A value ofBORDER_OVERLAP
causes the borders to overlap, making the border appear continuous in the transition from the header cells to the body cells.- Parameters:
headerGap
- the new header gap.
-
getBodyBackground
public org.eclipse.swt.graphics.RGB getBodyBackground()Returns the body background color. Default is null (no background color).- Returns:
- the body background color.
-
setBodyBackground
public void setBodyBackground(org.eclipse.swt.graphics.RGB bodyBackground)Sets the body background color. Calls to this method override any previous calls to setBodyBackgroundProvider(...).- Parameters:
bodyBackground
- the new background color.
-
getBodyBackgroundProvider
Returns the body background color provider.- Returns:
- the body background color provider.
-
setBodyBackgroundProvider
Sets the body background color provider. Calls to this method override any previous calls to setBodyBackground(RGB). Setting this property to null restores the default background provider.- Parameters:
bodyBackgroundProvider
- the new background color provider.
-
getFooterGap
public int getFooterGap()Returns the vertical gap between the body and footer cells. Default is BORDER_OVERLAP.- Returns:
- the vertical gap between the header and body cells.
-
setFooterGap
public void setFooterGap(int footerGap)Sets the vertical gap between the header and body cells. A value ofBORDER_OVERLAP
causes the borders to overlap, making the border appear continuous in the transition from the body cells to the footer cells.- Parameters:
footerGap
-
-
getFooterBackground
public org.eclipse.swt.graphics.RGB getFooterBackground()Returns the footer background color. If null, the body background color is used. Default is null.- Returns:
- the footer background color.
-
setFooterBackground
public void setFooterBackground(org.eclipse.swt.graphics.RGB footerBackground)Sets the footer background color. Calls to this method override any previous calls to setFooterBackgroundProvider(...).- Parameters:
footerBackground
- the new background color. If null, the body background color will be used.
-
getFooterBackgroundProvider
Returns the footer background color provider.- Returns:
- the footer background color provider.
-
setFooterBackgroundProvider
Sets the footer background color provider. Calls to this method override any previous calls to setFooterBackground(RGB). Setting this property to null restores the default background provider.- Parameters:
footerBackgroundProvider
- the new background color provider.
-
getPainter
public GridLookPainter getPainter(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc)Description copied from interface:GridLook
Returns a GridLookPainter for painting the GridLook.- Specified by:
getPainter
in interfaceGridLook
- Parameters:
device
- the device to paint on.gc
- the graphics context for painting.- Returns:
- a GridLookPainter for painting the GridLook.
-