Class CellPainterDecorator
java.lang.Object
org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CellPainterDecorator
- All Implemented Interfaces:
ICellPainter
Decorates a cell painter with another cell painter.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates aCellPainterDecoratorwithout any configuration to support initialization afterwards.CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, int spacing, ICellPainter decoratorCellPainter) Will create aCellPainterDecoratorwith the given amount of pixels as spacing between base and decoration painter, where the base painter is rendered dependent to the decoration.CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, int spacing, ICellPainter decoratorCellPainter, boolean paintDecorationDependent) Will create aCellPainterDecoratorwith the given amount of pixels as spacing between base and decoration painter.CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, int spacing, ICellPainter decoratorCellPainter, boolean paintDecorationDependent, boolean paintBg) Will create aCellPainterDecoratorwith the given amount of pixels as spacing between base and decoration painter.CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, ICellPainter decoratorCellPainter) Will create aCellPainterDecoratorwith the default spacing of 2 between base and decoration painter, where the base painter is rendered dependent to the decoration.CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, ICellPainter decoratorCellPainter, boolean paintDecorationDependent) Will create aCellPainterDecoratorwith the default spacing of 2 between base and decoration painter. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.swt.graphics.RectanglegetBaseCellPainterBounds(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle adjustedCellBounds, IConfigRegistry configRegistry) getCellPainterAt(int x, int y, ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle adjustedCellBounds, IConfigRegistry configRegistry) org.eclipse.swt.graphics.RectanglegetDecoratorCellPainterBounds(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle adjustedCellBounds, IConfigRegistry configRegistry) intgetPreferredHeight(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry) Get the preferred height of the cell when rendered by this painter.intgetPreferredWidth(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry) Get the preferred width of the cell when rendered by this painter.intvoidpaintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle adjustedCellBounds, IConfigRegistry configRegistry) voidsetBaseCellPainter(ICellPainter baseCellPainter) voidsetCellEdge(CellEdgeEnum cellEdge) voidsetDecoratorCellPainter(ICellPainter decoratorCellPainter) voidsetPaintBackground(boolean paintBg) Configure whether this CellPainterDecorator should paint the background or not.voidsetPaintDecorationDependent(boolean paintDecorationDependent) voidsetSpacing(int spacing)
-
Constructor Details
-
CellPainterDecorator
public CellPainterDecorator()Creates aCellPainterDecoratorwithout any configuration to support initialization afterwards.- Since:
- 1.4
-
CellPainterDecorator
public CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, ICellPainter decoratorCellPainter) Will create aCellPainterDecoratorwith the default spacing of 2 between base and decoration painter, where the base painter is rendered dependent to the decoration.- Parameters:
baseCellPainter- The baseICellPainterthat should be decoratedcellEdge- The edge of the cell at which the decoration should be applieddecoratorCellPainter- TheICellPainterthat should be used to render the decoration.
-
CellPainterDecorator
public CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, ICellPainter decoratorCellPainter, boolean paintDecorationDependent) Will create aCellPainterDecoratorwith the default spacing of 2 between base and decoration painter. If paintDecorationDependent is set tofalse, the spacing will be ignored.- Parameters:
baseCellPainter- The baseICellPainterthat should be decoratedcellEdge- The edge of the cell at which the decoration should be applieddecoratorCellPainter- TheICellPainterthat should be used to render the decoration.paintDecorationDependent- Flag to specify whether the base painter should render dependent to the decoration painter or not.
-
CellPainterDecorator
public CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, int spacing, ICellPainter decoratorCellPainter) Will create aCellPainterDecoratorwith the given amount of pixels as spacing between base and decoration painter, where the base painter is rendered dependent to the decoration.- Parameters:
baseCellPainter- The baseICellPainterthat should be decoratedcellEdge- The edge of the cell at which the decoration should be appliedspacing- The amount of pixels that should be used as spacing between decoration and base painterdecoratorCellPainter- TheICellPainterthat should be used to render the decoration.
-
CellPainterDecorator
public CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, int spacing, ICellPainter decoratorCellPainter, boolean paintDecorationDependent) Will create aCellPainterDecoratorwith the given amount of pixels as spacing between base and decoration painter. If paintDecorationDependent is set tofalse, the spacing will be ignored while the decoration is mainly rendered over the base painter.- Parameters:
baseCellPainter- The baseICellPainterthat should be decoratedcellEdge- The edge of the cell at which the decoration should be applieddecoratorCellPainter- TheICellPainterthat should be used to render the decoration.paintDecorationDependent- Flag to specify whether the base painter should render dependent to the decoration painter or not.
-
CellPainterDecorator
public CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, int spacing, ICellPainter decoratorCellPainter, boolean paintDecorationDependent, boolean paintBg) Will create aCellPainterDecoratorwith the given amount of pixels as spacing between base and decoration painter. If paintDecorationDependent is set tofalse, the spacing will be ignored while the decoration is mainly rendered over the base painter.- Parameters:
baseCellPainter- The baseICellPainterthat should be decoratedcellEdge- The edge of the cell at which the decoration should be applieddecoratorCellPainter- TheICellPainterthat should be used to render the decoration.paintDecorationDependent- Flag to specify whether the base painter should render dependent to the decoration painter or not.paintBg-trueif the PaddingDecorator should paint the background,falseif not.
-
-
Method Details
-
setPaintDecorationDependent
public void setPaintDecorationDependent(boolean paintDecorationDependent) - Parameters:
paintDecorationDependent-trueif the base painter should render dependent to the decoration painter,falseif the decoration should be rendered over the base painter.
-
setPaintBackground
public void setPaintBackground(boolean paintBg) Configure whether this CellPainterDecorator should paint the background or not. By default it will paint the background to ensure the spacing is also painted in the configured background color. This will only cause issues in case another background painter like the GradientBackroundPainter should be used.- Parameters:
paintBg-trueif this CellPainterDecorator should also paint the background,falseif the background should not be painted.
-
getPreferredWidth
public int getPreferredWidth(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry) Description copied from interface:ICellPainterGet the preferred width of the cell when rendered by this painter. Used for auto-resize.- Specified by:
getPreferredWidthin interfaceICellPainter- Parameters:
cell- The cell for which the preferred width is requested.gc- The GC that is used for rendering.configRegistry- The IConfigRegistry that contains the configuration used for rendering.- Returns:
- The preferred width of the given cell when rendered by this painter.
-
getPreferredHeight
public int getPreferredHeight(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry) Description copied from interface:ICellPainterGet the preferred height of the cell when rendered by this painter. Used for auto-resize.- Specified by:
getPreferredHeightin interfaceICellPainter- Parameters:
cell- The cell for which the preferred height is requested.gc- The GC that is used for rendering.configRegistry- The IConfigRegistry that contains the configuration used for rendering.- Returns:
- The preferred height of the given cell when rendered by this painter.
-
paintCell
public void paintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle adjustedCellBounds, IConfigRegistry configRegistry) - Specified by:
paintCellin interfaceICellPainter
-
getBaseCellPainterBounds
public org.eclipse.swt.graphics.Rectangle getBaseCellPainterBounds(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle adjustedCellBounds, IConfigRegistry configRegistry) - Returns:
- The Rectangle which can be used by the base cell painter.
-
getDecoratorCellPainterBounds
public org.eclipse.swt.graphics.Rectangle getDecoratorCellPainterBounds(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle adjustedCellBounds, IConfigRegistry configRegistry) - Returns:
- The Rectangle to paint the decoration.
-
getCellPainterAt
public ICellPainter getCellPainterAt(int x, int y, ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle adjustedCellBounds, IConfigRegistry configRegistry) - Specified by:
getCellPainterAtin interfaceICellPainter
-
getBaseCellPainter
- Returns:
- The base
ICellPainterthat is decorated.
-
setBaseCellPainter
- Parameters:
baseCellPainter- The baseICellPainterthat should be decorated.
-
getDecoratorCellPainter
- Returns:
- The
ICellPainterthat is used to render the decoration.
-
setDecoratorCellPainter
- Parameters:
decoratorCellPainter- TheICellPainterthat should be used to render the decoration.
-
getCellEdge
- Returns:
- The edge of the cell at which the decoration is applied.
-
setCellEdge
- Parameters:
cellEdge- The edge of the cell at which the decoration should be applied.
-
getSpacing
public int getSpacing()- Returns:
- The spacing that is used between base painter and decoration painter.
-
setSpacing
public void setSpacing(int spacing) - Parameters:
spacing- The spacing that should be used between base painter and decoration painter.
-