Class GridLineCellLayerPainter
java.lang.Object
org.eclipse.nebula.widgets.nattable.painter.layer.CellLayerPainter
org.eclipse.nebula.widgets.nattable.painter.layer.GridLineCellLayerPainter
- All Implemented Interfaces:
ILayerPainter
- Direct Known Subclasses:
ColumnGroupHeaderGridLineCellLayerPainter
,RowGroupHeaderGridLineCellLayerPainter
,SelectionLayerPainter
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreate a GridLineCellLayerPainter that renders gray grid lines and uses the default clipping behaviour.GridLineCellLayerPainter
(boolean clipLeft, boolean clipTop) Create a GridLineCellLayerPainter that renders gray grid lines and uses the specified clipping behaviour.GridLineCellLayerPainter
(org.eclipse.swt.graphics.Color gridColor) Create a GridLineCellLayerPainter that renders grid lines in the specified color and uses the default clipping behaviour.GridLineCellLayerPainter
(org.eclipse.swt.graphics.Color gridColor, boolean clipLeft, boolean clipTop) Create a GridLineCellLayerPainter that renders grid lines in the specified color and uses the specified clipping behaviour. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.swt.graphics.Rectangle
adjustCellBounds
(int columnPosition, int rowPosition, org.eclipse.swt.graphics.Rectangle bounds) This method is used to adjust the cell bounds when painting the layer.protected void
drawGridLines
(ILayer natLayer, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle, IConfigRegistry configRegistry, List<String> labels) org.eclipse.swt.graphics.Color
void
paintLayer
(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle rectangle, IConfigRegistry configRegistry) Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.layer.CellLayerPainter
getPositionRectangleFromPixelRectangle, getStartXOfColumnPosition, getStartYOfRowPosition, isClipLeft, isClipTop, paintCell
-
Field Details
-
renderGridLines
protected boolean renderGridLines- Since:
- 1.5
-
gridLineWidth
- Since:
- 1.4
-
-
Constructor Details
-
GridLineCellLayerPainter
public GridLineCellLayerPainter(org.eclipse.swt.graphics.Color gridColor) Create a GridLineCellLayerPainter that renders grid lines in the specified color and uses the default clipping behaviour.- Parameters:
gridColor
- The color that should be used to render the grid lines.
-
GridLineCellLayerPainter
public GridLineCellLayerPainter()Create a GridLineCellLayerPainter that renders gray grid lines and uses the default clipping behaviour. -
GridLineCellLayerPainter
public GridLineCellLayerPainter(org.eclipse.swt.graphics.Color gridColor, boolean clipLeft, boolean clipTop) Create a GridLineCellLayerPainter that renders grid lines in the specified color and uses the specified clipping behaviour.- Parameters:
gridColor
- The color that should be used to render the grid lines.clipLeft
- Configure the rendering behaviour when cells overlap. If set totrue
the left cell will be clipped, if set tofalse
the right cell will be clipped. The default value isfalse
.clipTop
- Configure the rendering behaviour when cells overlap. If set totrue
the top cell will be clipped, if set tofalse
the bottom cell will be clipped. The default value isfalse
.
-
GridLineCellLayerPainter
public GridLineCellLayerPainter(boolean clipLeft, boolean clipTop) Create a GridLineCellLayerPainter that renders gray grid lines and uses the specified clipping behaviour.- Parameters:
clipLeft
- Configure the rendering behaviour when cells overlap. If set totrue
the left cell will be clipped, if set tofalse
the right cell will be clipped. The default value isfalse
.clipTop
- Configure the rendering behaviour when cells overlap. If set totrue
the top cell will be clipped, if set tofalse
the bottom cell will be clipped. The default value isfalse
.
-
-
Method Details
-
getGridColor
public org.eclipse.swt.graphics.Color getGridColor()- Returns:
- The local configured color that is used to render the grid lines.
-
paintLayer
public void paintLayer(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle rectangle, IConfigRegistry configRegistry) - Specified by:
paintLayer
in interfaceILayerPainter
- Overrides:
paintLayer
in classCellLayerPainter
- Parameters:
natLayer
- The layer to paint.gc
- GC used for paintingxOffset
- x offset of the layer from the origin of the tableyOffset
- y offset of the layer from the origin of the tablerectangle
- area the layer can paint inconfigRegistry
-IConfigRegistry
in use by NatTable. Useful for looking up associated painters.
-
adjustCellBounds
public org.eclipse.swt.graphics.Rectangle adjustCellBounds(int columnPosition, int rowPosition, org.eclipse.swt.graphics.Rectangle bounds) Description copied from interface:ILayerPainter
This method is used to adjust the cell bounds when painting the layer. This is most often used to reduce the size of the cell to accommodate grid lines.- Specified by:
adjustCellBounds
in interfaceILayerPainter
- Overrides:
adjustCellBounds
in classCellLayerPainter
- Parameters:
columnPosition
- The column position.rowPosition
- The row position.bounds
- The actual cell bounds.- Returns:
- The adjusted cell bounds.
-
drawGridLines
protected void drawGridLines(ILayer natLayer, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle, IConfigRegistry configRegistry, List<String> labels) - Parameters:
natLayer
- The layer to paint on.gc
- GC used for paintingrectangle
- area the layer can paint inconfigRegistry
-IConfigRegistry
in use, needed to retrieve configured grid line color.labels
- region labels needed to retrieve the configured grid line color.- Since:
- 1.4
-