Class CellLayerPainter
java.lang.Object
org.eclipse.nebula.widgets.nattable.painter.layer.CellLayerPainter
- All Implemented Interfaces:
ILayerPainter
- Direct Known Subclasses:
GridLineCellLayerPainter
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a default CellLayerPainter with default clipping behaviour.CellLayerPainter(boolean clipLeft, boolean clipTop) Create a CellLayerPainter with specified clipping behaviour. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.swt.graphics.RectangleadjustCellBounds(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.RectanglegetPositionRectangleFromPixelRectangle(ILayer natLayer, org.eclipse.swt.graphics.Rectangle pixelRectangle) protected intgetStartXOfColumnPosition(int columnPosition) protected intgetStartYOfRowPosition(int rowPosition) protected booleanisClipLeft(int position) Determines the rendering behavior when two cells overlap.protected booleanisClipTop(int position) Determines the rendering behavior when two cells overlap.protected voidpaintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry) voidpaintLayer(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle pixelRectangle, IConfigRegistry configRegistry)
-
Constructor Details
-
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 totruethe left cell will be clipped, if set tofalsethe right cell will be clipped. The default value isfalse.clipTop- Configure the rendering behaviour when cells overlap. If set totruethe top cell will be clipped, if set tofalsethe bottom cell will be clipped. The default value isfalse.
-
-
Method Details
-
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:
paintLayerin 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-IConfigRegistryin 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:
trueif the left cell will be clipped,falseif 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:
trueif the top cell will be clipped,falseif 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:ILayerPainterThis 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:
adjustCellBoundsin 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)
-