Class CompositeFreezeLayerPainter

java.lang.Object
org.eclipse.nebula.widgets.nattable.layer.CompositeLayer.CompositeLayerPainter
org.eclipse.nebula.widgets.nattable.painter.layer.CompositeFreezeLayerPainter
All Implemented Interfaces:
ILayerPainter

public class CompositeFreezeLayerPainter extends CompositeLayer.CompositeLayerPainter
CompositeLayer that is used to render the freeze border. Can also be used set on a top-level CompositeLayer to render the freeze border also on adjacent regions, e.g. in a GridLayer to render the freeze border also inside the column header and row header.
Since:
1.6
See Also:
  • Constructor Details

    • CompositeFreezeLayerPainter

      public CompositeFreezeLayerPainter(CompositeFreezeLayer compositeFreezeLayer)
      Creates a CompositeFreezeLayerPainter that can be set directly on a CompositeFreezeLayer. This way the freeze border will be rendered only inside the CompositeFreezeLayer.
      Parameters:
      compositeFreezeLayer - The CompositeFreezeLayer for rendering the freeze border.
    • CompositeFreezeLayerPainter

      public CompositeFreezeLayerPainter(CompositeLayer compositeLayer, CompositeFreezeLayer compositeFreezeLayer)
      Creates a CompositeFreezeLayerPainter that can be set on a CompositeLayer that contains a CompositeFreezeLayer. This way the freeze border will be rendered also on the adjacent regions. For this typically the given compositeLayer is inspected and the freeze border is moved by the width/height of the first layers on top and to the left, as we do not know the needed offset values on the higher level composition.
      Parameters:
      compositeLayer - The top level CompositeLayer, e.g. a GridLayer.
      compositeFreezeLayer - The CompositeFreezeLayer for rendering the freeze border.
    • CompositeFreezeLayerPainter

      public CompositeFreezeLayerPainter(CompositeLayer compositeLayer, CompositeFreezeLayer compositeFreezeLayer, boolean inspectComposite)
      Creates a CompositeFreezeLayerPainter that can be set on a CompositeLayer that contains a CompositeFreezeLayer. This way the freeze border will be rendered also on the adjacent regions. For this typically the given compositeLayer is inspected and the freeze border is moved by the width/height of the first layers on top and to the left, as we do not know the needed offset values on the higher level composition.

      Note: Via the inspectComposite parameter the behavior in more complex layer compositions with nested CompositeLayer can be adjusted.

      Parameters:
      compositeLayer - The top level CompositeLayer, e.g. a GridLayer.
      compositeFreezeLayer - The CompositeFreezeLayer for rendering the freeze border.
      inspectComposite - true if the given compositeLayer should be inspected for the position of the freeze border, false if not. Default is true. Remember to add nested layers to manually configure the freeze border shift when setting this value to false.
      See Also:
  • Method Details

    • 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 CompositeLayer.CompositeLayerPainter
      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.
    • getHeight

      protected int getHeight()
      Returns the height of the freeze border dependent on the configured layers this painter is attached to.
      Returns:
      The height of the freeze border.
    • getWidth

      protected int getWidth()
      Returns the width of the freeze border dependent on the configured layers this painter is attached to.
      Returns:
      The width of the freeze border.
    • getFreezeX

      protected int getFreezeX(int xOffset)
      Returns the x coordinate of the freeze border.
      Parameters:
      xOffset - The composition offset.
      Returns:
      The x coordinate value for the horizontal freeze border.
    • getFreezeY

      protected int getFreezeY(int yOffset)
      Returns the y coordinate of the freeze border.
      Parameters:
      yOffset - The composition offset.
      Returns:
      The y coordinate value for the vertical freeze border.
    • addNestedVerticalLayer

      public void addNestedVerticalLayer(ILayer layer)
      Adds the given layer to the list of nested vertical layers that are used to shift the freeze border down. Needed in case of nested compositions, e.g. using a fixed summary row in the body region.
      Parameters:
      layer - The ILayer to add.
    • addNestedHorizontalLayer

      public void addNestedHorizontalLayer(ILayer layer)
      Adds the given layer to the list of nested horizontal layers that are used to shift the freeze border to the right. Needed in case of nested compositions in the body region.
      Parameters:
      layer - The ILayer to add.