Class CellLayerPainter

    • Constructor Detail

      • 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 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 Detail

      • 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:
        paintLayer in interface ILayerPainter
        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
        pixelRectangle - area the layer can paint in
        configRegistry - IConfigRegistry in use by NatTable. Useful for looking up associated painters.
      • isClipLeft

        protected boolean isClipLeft​(int position)
        Determines the rendering behavior when two cells overlap. If true, the left cell will be clipped. If false, 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:
        true if the left cell will be clipped, false if the right cell will be clipped.
      • isClipTop

        protected boolean isClipTop​(int position)
        Determines the rendering behavior when two cells overlap. If true, the top cell will be clipped. If false, 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:
        true if the top cell will be clipped, false if 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: 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
        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)