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

public class GridLineCellLayerPainter extends CellLayerPainter
  • Field Details

    • renderGridLines

      protected boolean renderGridLines
      Since:
      1.5
    • gridLineWidth

      protected Integer 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 to true the left cell will be clipped, if set to false the right cell will be clipped. The default value is false.
      clipTop - Configure the rendering behaviour when cells overlap. If set to true the top cell will be clipped, if set to false the bottom cell will be clipped. The default value is false.
    • 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 to true the left cell will be clipped, if set to false the right cell will be clipped. The default value is false.
      clipTop - Configure the rendering behaviour when cells overlap. If set to true the top cell will be clipped, if set to false the bottom cell will be clipped. The default value is false.
  • 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 interface ILayerPainter
      Overrides:
      paintLayer in class CellLayerPainter
      Parameters:
      natLayer - The layer to paint.
      gc - GC used for painting
      xOffset - x offset of the layer from the origin of the table
      yOffset - y offset of the layer from the origin of the table
      rectangle - area the layer can paint in
      configRegistry - 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 interface ILayerPainter
      Overrides:
      adjustCellBounds in class CellLayerPainter
      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 painting
      rectangle - area the layer can paint in
      configRegistry - IConfigRegistry in use, needed to retrieve configured grid line color.
      labels - region labels needed to retrieve the configured grid line color.
      Since:
      1.4