Class NatTableBorderOverlayPainter

java.lang.Object
org.eclipse.nebula.widgets.nattable.painter.NatTableBorderOverlayPainter
All Implemented Interfaces:
IOverlayPainter, IOverlayPainter2

public class NatTableBorderOverlayPainter extends Object implements IOverlayPainter2
IOverlayPainter that renders the left and the top border of a NatTable.

This is necessary because by default the left and the top borders are not rendered so it is possible to create composite stacks that do not create double sized borders (e.g. between row header and body). Mainly the issue results because of several offset calculations all over the NatTable rendering code.

For completeness this painter is also able to render the right and the bottom border to ensure that the border has the same color around the NatTable without changing the grid line color.

  • Constructor Details

    • NatTableBorderOverlayPainter

      public NatTableBorderOverlayPainter()
      Creates a NatTableBorderOverlayPainter that paints gray border lines to the top and to the left.
    • NatTableBorderOverlayPainter

      public NatTableBorderOverlayPainter(IConfigRegistry configRegistry)
      Creates a NatTableBorderOverlayPainter that paints by default gray border lines to the top and to the left.
      Parameters:
      configRegistry - The IConfigRegistry to dynamically load the grid line color. If a configuration value is found, it will be used instead of the gray default color.
    • NatTableBorderOverlayPainter

      public NatTableBorderOverlayPainter(boolean renderAllBorderLines)
      Creates a NatTableBorderOverlayPainter that paints gray border lines.
      Parameters:
      renderAllBorderLines - true if all border lines should be rendered, false if only the left and the top border line need to be rendered.
    • NatTableBorderOverlayPainter

      public NatTableBorderOverlayPainter(boolean renderAllBorderLines, IConfigRegistry configRegistry)
      Creates a NatTableBorderOverlayPainter that paints gray border lines by default.
      Parameters:
      renderAllBorderLines - true if all border lines should be rendered, false if only the left and the top border line need to be rendered.
      configRegistry - The IConfigRegistry to dynamically load the grid line color. If a configuration value is found, it will be used instead of the gray default color.
    • NatTableBorderOverlayPainter

      public NatTableBorderOverlayPainter(org.eclipse.swt.graphics.Color borderColor)
      Creates a NatTableBorderOverlayPainter that paints border lines to the top and to the left.
      Parameters:
      borderColor - The color that should be used to render the border lines.
    • NatTableBorderOverlayPainter

      public NatTableBorderOverlayPainter(org.eclipse.swt.graphics.Color borderColor, IConfigRegistry configRegistry)
      Creates a NatTableBorderOverlayPainter that paints border lines to the top and to the left.
      Parameters:
      borderColor - The default color that should be used to render the border lines.
      configRegistry - The IConfigRegistry to dynamically load the grid line color. If a configuration value is found, it will be used instead of the given default color.
    • NatTableBorderOverlayPainter

      public NatTableBorderOverlayPainter(org.eclipse.swt.graphics.Color borderColor, boolean renderAllBorderLines)
      Creates a NatTableBorderOverlayPainter that paints border lines.
      Parameters:
      borderColor - The color that should be used to render the border lines.
      renderAllBorderLines - true if all border lines should be rendered, false if only the left and the top border line need to be rendered.
    • NatTableBorderOverlayPainter

      public NatTableBorderOverlayPainter(org.eclipse.swt.graphics.Color borderColor, boolean renderAllBorderLines, IConfigRegistry configRegistry)
      Creates a NatTableBorderOverlayPainter that paints border lines.
      Parameters:
      borderColor - The color that should be used to render the border lines.
      renderAllBorderLines - true if all border lines should be rendered, false if only the left and the top border line need to be rendered.
  • Method Details

    • paintOverlay

      public void paintOverlay(org.eclipse.swt.graphics.GC gc, ILayer layer)
      Specified by:
      paintOverlay in interface IOverlayPainter
    • paintOverlay

      public void paintOverlay(ILayer layer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle rectangle)
      Description copied from interface: IOverlayPainter2
      Render an overlay over the painted layers.
      Specified by:
      paintOverlay in interface IOverlayPainter2
      Parameters:
      layer - The layer as base for the overlay rendering.
      gc - The GC.
      xOffset - The x offset.
      yOffset - The y offset.
      rectangle - The print bounds for the rendering action.
      Since:
      1.4
    • getBorderColor

      public org.eclipse.swt.graphics.Color getBorderColor()
      Checks if a IConfigRegistry is set to this NatTableBorderOverlayPainter and will try to extract the configuration value for CellConfigAttributes.GRID_LINE_COLOR. If there is no IConfigRegistry set or there is no value for the attribute in the set IConfigRegistry, the Color set as member will be used.
      Returns:
      The Color that will be used to render the grid lines.
      Since:
      1.4