Class NatGridLayerPainter
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.painter.layer.NatLayerPainter
-
- org.eclipse.nebula.widgets.nattable.painter.layer.NatGridLayerPainter
-
- All Implemented Interfaces:
ILayerPainter
public class NatGridLayerPainter extends NatLayerPainter
Specialization of NatLayerPainter that fills the background with grid lines to create the same look and feel as native table controls. It is possible to specify the grid line color directly or via ConfigRegistryCellConfigAttributes.GRID_LINE_COLOR
, where the ConfigRegistry entry will win over direct configuration.If there should be several fake rows rendered, you need to set the default row height that should be used for rendering the fake row lines. Otherwise this will be skipped and only the column lines will be rendered to the bottom.
-
-
Field Summary
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.painter.layer.NatLayerPainter
natTable
-
-
Constructor Summary
Constructors Constructor Description NatGridLayerPainter(NatTable natTable)
NatGridLayerPainter(NatTable natTable, int defaultRowHeight)
NatGridLayerPainter(NatTable natTable, org.eclipse.swt.graphics.Color gridColor)
NatGridLayerPainter(NatTable natTable, org.eclipse.swt.graphics.Color gridColor, int defaultRowHeight)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDefaultRowHeight()
protected void
paintBackground(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle rectangle, IConfigRegistry configRegistry)
void
setDefaultRowHeight(int defaultRowHeight)
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.layer.NatLayerPainter
adjustCellBounds, paintLayer, paintOverlays
-
-
-
-
Constructor Detail
-
NatGridLayerPainter
public NatGridLayerPainter(NatTable natTable)
- Parameters:
natTable
- The NatTable instance for which the NatGridLayerPainter should render the background.
-
NatGridLayerPainter
public NatGridLayerPainter(NatTable natTable, org.eclipse.swt.graphics.Color gridColor)
- Parameters:
natTable
- The NatTable instance for which the NatGridLayerPainter should render the background.gridColor
- The Color that should be used to render the grid lines. Note that an entry forCellConfigAttributes.GRID_LINE_COLOR
will override this value at runtime.
-
NatGridLayerPainter
public NatGridLayerPainter(NatTable natTable, int defaultRowHeight)
- Parameters:
natTable
- The NatTable instance for which the NatGridLayerPainter should render the background.defaultRowHeight
- The row height that should be used to render fake rows to the bottom. Setting a value of 0 will avoid rendering fake row lines.
-
NatGridLayerPainter
public NatGridLayerPainter(NatTable natTable, org.eclipse.swt.graphics.Color gridColor, int defaultRowHeight)
- Parameters:
natTable
- The NatTable instance for which the NatGridLayerPainter should render the background.gridColor
- The Color that should be used to render the grid lines. Note that an entry forCellConfigAttributes.GRID_LINE_COLOR
will override this value at runtime.defaultRowHeight
- The row height that should be used to render fake rows to the bottom. Setting a value of 0 will avoid rendering fake row lines.
-
-
Method Detail
-
paintBackground
protected void paintBackground(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle rectangle, IConfigRegistry configRegistry)
- Overrides:
paintBackground
in classNatLayerPainter
-
getDefaultRowHeight
public int getDefaultRowHeight()
- Returns:
- The currently used height that is used to render fake rows. The pixel value is locally stored scaled.
-
setDefaultRowHeight
public void setDefaultRowHeight(int defaultRowHeight)
- Parameters:
defaultRowHeight
- The value that should be used to render fake rows. The value needs to be given in pixels, as the scaling calculation is done in here.
-
-