Class IndentedTreeImagePainter
java.lang.Object
org.eclipse.nebula.widgets.nattable.painter.cell.AbstractCellPainter
org.eclipse.nebula.widgets.nattable.painter.cell.CellPainterWrapper
org.eclipse.nebula.widgets.nattable.tree.painter.IndentedTreeImagePainter
- All Implemented Interfaces:
ICellPainter
Implementation of CellPainterWrapper that is used to render tree structures
in NatTable. It puts indentation to tree nodes to visualize the tree
structure and adds expand/collapse icons corresponding to the state if a tree
node has children.
-
Constructor Summary
ConstructorDescriptionCreates an IndentedTreeImagePainter.IndentedTreeImagePainter
(int treeIndent) Creates an IndentedTreeImagePainter.IndentedTreeImagePainter
(int treeIndent, ICellPainter treeImagePainter) Creates an IndentedTreeImagePainter using the given indentation per depth andICellPainter
for painting the icons in the tree.IndentedTreeImagePainter
(int treeIndent, ICellPainter interiorPainter, boolean paintBg, boolean interiorPainterToSpanFullWidth) Creates aIndentedTreeImagePainter
that uses the givenICellPainter
as baseICellPainter
and decorate it with theTreeImagePainter
on the right edge of the cell.IndentedTreeImagePainter
(int treeIndent, ICellPainter interiorPainter, CellEdgeEnum cellEdge, boolean paintBg, int spacing, boolean paintDecorationDependent) IndentedTreeImagePainter
(int treeIndent, ICellPainter interiorPainter, CellEdgeEnum cellEdge, ICellPainter decoratorPainter, boolean paintBg, int spacing, boolean paintDecorationDependent) IndentedTreeImagePainter
(int treeIndent, CellEdgeEnum cellEdge, ICellPainter treeImagePainter) Creates an IndentedTreeImagePainter using the given indentation per depth andICellPainter
for painting the icons in the tree to the specified cell edge. -
Method Summary
Modifier and TypeMethodDescriptionprotected int
getDepth
(ILayerCell cell) protected int
getIndent
(int depth, IConfigRegistry configRegistry) int
getPreferredWidth
(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry) Get the preferred width of the cell when rendered by this painter.org.eclipse.swt.graphics.Rectangle
getWrappedPainterBounds
(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, IConfigRegistry configRegistry) void
paintCell
(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, IConfigRegistry configRegistry) void
setBaseCellPainter
(ICellPainter cellPainter) void
setTreeImagePainter
(ICellPainter cellPainter) Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.CellPainterWrapper
getCellPainterAt, getPreferredHeight, getWrappedPainter, setWrappedPainter
-
Constructor Details
-
IndentedTreeImagePainter
public IndentedTreeImagePainter()Creates an IndentedTreeImagePainter. Will use 10 pixels for indentation per depth and a default TreeImagePainter for rendering the icons in the tree. -
IndentedTreeImagePainter
public IndentedTreeImagePainter(int treeIndent) Creates an IndentedTreeImagePainter. Will use the given number of pixels for indentation per depth and a defaultTreeImagePainter
for rendering the icons in the tree.- Parameters:
treeIndent
- The number of pixels to indent per depth.
-
IndentedTreeImagePainter
Creates an IndentedTreeImagePainter using the given indentation per depth andICellPainter
for painting the icons in the tree.- Parameters:
treeIndent
- The number of pixels to indent per depth.treeImagePainter
- TheICellPainter
that should be used to paint the images in the tree. When using the DefaultTreeLayerConfiguration the content painter needs to be of type ofTreeImagePainter
that paints expand/collapse/leaf icons regarding the node state, because the ui bindings for expand/collapse are registered against that type.- Since:
- 1.6
-
IndentedTreeImagePainter
public IndentedTreeImagePainter(int treeIndent, CellEdgeEnum cellEdge, ICellPainter treeImagePainter) Creates an IndentedTreeImagePainter using the given indentation per depth andICellPainter
for painting the icons in the tree to the specified cell edge.- Parameters:
treeIndent
- The number of pixels to indent per depth.cellEdge
- the edge of the cell on which the tree state indicator decoration should be appliedtreeImagePainter
- TheICellPainter
that should be used to paint the images in the tree. When using the DefaultTreeLayerConfiguration the content painter needs to be of type ofTreeImagePainter
that paints expand/collapse/leaf icons regarding the node state, because the ui bindings for expand/collapse are registered against that type.- Since:
- 1.6
-
IndentedTreeImagePainter
public IndentedTreeImagePainter(int treeIndent, ICellPainter interiorPainter, CellEdgeEnum cellEdge, boolean paintBg, int spacing, boolean paintDecorationDependent) Creates aIndentedTreeImagePainter
that uses the givenICellPainter
as baseICellPainter
. It will use theTreeImagePainter
as decorator for tree state related decorations at the specified cell edge, which can be configured to render the background or not via method parameter. With the additional parameters, the behaviour of the createdCellPainterDecorator
can be configured in terms of rendering.- Parameters:
treeIndent
- The number of pixels to indent per depth.interiorPainter
- the baseICellPainter
to usecellEdge
- the edge of the cell on which the tree state indicator decoration should be appliedpaintBg
- flag to configure whether theTreeImagePainter
should paint the background or notspacing
- the number of pixels that should be used as spacing between cell edge and decorationpaintDecorationDependent
- flag to configure if the baseICellPainter
should render decoration dependent or not. If it is set tofalse
, the base painter will always paint at the same coordinates, using the whole cell bounds,true
will cause the bounds of the cell to shrink for the base painter.
-
IndentedTreeImagePainter
public IndentedTreeImagePainter(int treeIndent, ICellPainter interiorPainter, CellEdgeEnum cellEdge, ICellPainter decoratorPainter, boolean paintBg, int spacing, boolean paintDecorationDependent) Creates aIndentedTreeImagePainter
that uses the givenICellPainter
as baseICellPainter
. It will use the givenICellPainter
as decorator for tree state related decorations at the specified cell edge, which can be configured to render the background or not via method parameter. With the additional parameters, the behaviour of the createdCellPainterDecorator
can be configured in terms of rendering.- Parameters:
treeIndent
- The number of pixels to indent per depth.interiorPainter
- the baseICellPainter
to usecellEdge
- the edge of the cell on which the tree state indicator decoration should be applieddecoratorPainter
- theICellPainter
that should be used to paint the tree state related decorationpaintBg
- flag to configure whether theCellPainterDecorator
should paint the background or notspacing
- the number of pixels that should be used as spacing between cell edge and decorationpaintDecorationDependent
- flag to configure if the baseICellPainter
should render decoration dependent or not. If it is set tofalse
, the base painter will always paint at the same coordinates, using the whole cell bounds,true
will cause the bounds of the cell to shrink for the base painter.
-
IndentedTreeImagePainter
public IndentedTreeImagePainter(int treeIndent, ICellPainter interiorPainter, boolean paintBg, boolean interiorPainterToSpanFullWidth) Creates aIndentedTreeImagePainter
that uses the givenICellPainter
as baseICellPainter
and decorate it with theTreeImagePainter
on the right edge of the cell. This constructor gives the opportunity to configure the behaviour of theTreeImagePainter
and theCellPainterDecorator
for some attributes. Remains because of downwards compatibility.- Parameters:
treeIndent
- The number of pixels to indent per depth.interiorPainter
- the baseICellPainter
to usepaintBg
- flag to configure whether theTreeImagePainter
should paint the background or notinteriorPainterToSpanFullWidth
- flag to configure how the bounds of the base painter should be calculated
-
-
Method Details
-
getTreeImagePainter
- Returns:
- The ICellPainter that is used to paint the images in the tree. Usually it is some type of TreeImagePainter that paints expand/collapse/leaf icons regarding the node state.
-
setTreeImagePainter
- Parameters:
cellPainter
- TheICellPainter
that should be used to paint the images in the tree. Usually it is some type ofTreeImagePainter
that paints expand/collapse/leaf icons regarding the node state.
-
setBaseCellPainter
- Parameters:
cellPainter
- The baseICellPainter
that should be used to render the cell content.
-
getInternalPainter
- Returns:
- The
CellPainterDecorator
that is wrapped by thisIndentedTreeImagePainter
. Can be used to perform specific decoration configurations, e.g. set the decoration dependent rendering option. - Since:
- 1.6
-
getWrappedPainterBounds
public org.eclipse.swt.graphics.Rectangle getWrappedPainterBounds(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, IConfigRegistry configRegistry) - Overrides:
getWrappedPainterBounds
in classCellPainterWrapper
-
paintCell
public void paintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, IConfigRegistry configRegistry) - Specified by:
paintCell
in interfaceICellPainter
- Overrides:
paintCell
in classCellPainterWrapper
-
getPreferredWidth
public int getPreferredWidth(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry) Description copied from interface:ICellPainter
Get the preferred width of the cell when rendered by this painter. Used for auto-resize.- Specified by:
getPreferredWidth
in interfaceICellPainter
- Overrides:
getPreferredWidth
in classCellPainterWrapper
- 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.
-
getIndent
- Parameters:
depth
- The depth/level in the tree structure for which the indent is requested.configRegistry
- TheIConfigRegistry
needed for accessing the dpi converter.- Returns:
- The number of pixels the content should be indented.
- Since:
- 2.0
-
getDepth
- Parameters:
cell
- The cell for which the depth/level in the tree structure is requested.- Returns:
- The depth/level in the tree structure the given cell is located.
- Since:
- 1.4
-