Class CellLayerPainter
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.painter.layer.CellLayerPainter
-
- All Implemented Interfaces:
ILayerPainter
- Direct Known Subclasses:
GridLineCellLayerPainter
public class CellLayerPainter extends Object implements ILayerPainter
-
-
Constructor Summary
Constructors Constructor Description CellLayerPainter()
Create a default CellLayerPainter with default clipping behaviour.CellLayerPainter(boolean clipLeft, boolean clipTop)
Create a CellLayerPainter with specified clipping behaviour.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.swt.graphics.Rectangle
adjustCellBounds(int columnPosition, int rowPosition, org.eclipse.swt.graphics.Rectangle cellBounds)
This method is used to adjust the cell bounds when painting the layer.protected org.eclipse.swt.graphics.Rectangle
getPositionRectangleFromPixelRectangle(ILayer natLayer, org.eclipse.swt.graphics.Rectangle pixelRectangle)
protected int
getStartXOfColumnPosition(int columnPosition)
protected int
getStartYOfRowPosition(int rowPosition)
protected boolean
isClipLeft(int position)
Determines the rendering behavior when two cells overlap.protected boolean
isClipTop(int position)
Determines the rendering behavior when two cells overlap.protected void
paintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry)
void
paintLayer(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle pixelRectangle, IConfigRegistry configRegistry)
-
-
-
Constructor Detail
-
CellLayerPainter
public CellLayerPainter()
Create a default CellLayerPainter with default clipping behaviour.
-
CellLayerPainter
public CellLayerPainter(boolean clipLeft, boolean clipTop)
Create a CellLayerPainter with 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 Detail
-
paintLayer
public void paintLayer(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle pixelRectangle, IConfigRegistry configRegistry)
- Specified by:
paintLayer
in interfaceILayerPainter
- 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 tablepixelRectangle
- area the layer can paint inconfigRegistry
-IConfigRegistry
in use by NatTable. Useful for looking up associated painters.
-
isClipLeft
protected boolean isClipLeft(int position)
Determines the rendering behavior when two cells overlap. Iftrue
, the left cell will be clipped. Iffalse
, the right cell will be clipped. Typically this value is changed in conjunction with split viewports.- Parameters:
position
- The column position for which the clipping behaviour is requested. By default for all columns the same clipping behaviour is used. Only for special cases like split viewports with one header, per position a different behaviour may be needed.- Returns:
true
if the left cell will be clipped,false
if the right cell will be clipped.
-
isClipTop
protected boolean isClipTop(int position)
Determines the rendering behavior when two cells overlap. Iftrue
, the top cell will be clipped. Iffalse
, the bottom cell will be clipped. Typically this value is changed in conjunction with split viewports.- Parameters:
position
- The row position for which the clipping behaviour is requested. By default for all rows the same clipping behaviour is used. Only for special cases like split viewports with one header, per position a different behaviour may be needed.- Returns:
true
if the top cell will be clipped,false
if the bottom cell will be clipped.
-
adjustCellBounds
public org.eclipse.swt.graphics.Rectangle adjustCellBounds(int columnPosition, int rowPosition, org.eclipse.swt.graphics.Rectangle cellBounds)
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
- Parameters:
columnPosition
- The column position.rowPosition
- The row position.cellBounds
- The actual cell bounds.- Returns:
- The adjusted cell bounds.
-
getPositionRectangleFromPixelRectangle
protected org.eclipse.swt.graphics.Rectangle getPositionRectangleFromPixelRectangle(ILayer natLayer, org.eclipse.swt.graphics.Rectangle pixelRectangle)
-
paintCell
protected void paintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry)
-
getStartXOfColumnPosition
protected int getStartXOfColumnPosition(int columnPosition)
-
getStartYOfRowPosition
protected int getStartYOfRowPosition(int rowPosition)
-
-