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
ConstructorsConstructorDescriptionCreates an IndentedTreeImagePainter.IndentedTreeImagePainter(int treeIndent) Creates an IndentedTreeImagePainter.IndentedTreeImagePainter(int treeIndent, ICellPainter treeImagePainter) Creates an IndentedTreeImagePainter using the given indentation per depth andICellPainterfor painting the icons in the tree.IndentedTreeImagePainter(int treeIndent, ICellPainter interiorPainter, boolean paintBg, boolean interiorPainterToSpanFullWidth) Creates aIndentedTreeImagePainterthat uses the givenICellPainteras baseICellPainterand decorate it with theTreeImagePainteron 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 andICellPainterfor painting the icons in the tree to the specified cell edge. -
Method Summary
Modifier and TypeMethodDescriptionprotected intgetDepth(ILayerCell cell) protected intgetIndent(int depth, IConfigRegistry configRegistry) intgetPreferredWidth(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.RectanglegetWrappedPainterBounds(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, IConfigRegistry configRegistry) voidpaintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, IConfigRegistry configRegistry) voidsetBaseCellPainter(ICellPainter cellPainter) voidsetTreeImagePainter(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 defaultTreeImagePainterfor 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 andICellPainterfor painting the icons in the tree.- Parameters:
treeIndent- The number of pixels to indent per depth.treeImagePainter- TheICellPainterthat should be used to paint the images in the tree. When using the DefaultTreeLayerConfiguration the content painter needs to be of type ofTreeImagePainterthat 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 andICellPainterfor 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- TheICellPainterthat should be used to paint the images in the tree. When using the DefaultTreeLayerConfiguration the content painter needs to be of type ofTreeImagePainterthat 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 aIndentedTreeImagePainterthat uses the givenICellPainteras baseICellPainter. It will use theTreeImagePainteras 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 createdCellPainterDecoratorcan be configured in terms of rendering.- Parameters:
treeIndent- The number of pixels to indent per depth.interiorPainter- the baseICellPainterto usecellEdge- the edge of the cell on which the tree state indicator decoration should be appliedpaintBg- flag to configure whether theTreeImagePaintershould 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 baseICellPaintershould 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,truewill 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 aIndentedTreeImagePainterthat uses the givenICellPainteras baseICellPainter. It will use the givenICellPainteras 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 createdCellPainterDecoratorcan be configured in terms of rendering.- Parameters:
treeIndent- The number of pixels to indent per depth.interiorPainter- the baseICellPainterto usecellEdge- the edge of the cell on which the tree state indicator decoration should be applieddecoratorPainter- theICellPainterthat should be used to paint the tree state related decorationpaintBg- flag to configure whether theCellPainterDecoratorshould 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 baseICellPaintershould 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,truewill cause the bounds of the cell to shrink for the base painter.
-
IndentedTreeImagePainter
public IndentedTreeImagePainter(int treeIndent, ICellPainter interiorPainter, boolean paintBg, boolean interiorPainterToSpanFullWidth) Creates aIndentedTreeImagePainterthat uses the givenICellPainteras baseICellPainterand decorate it with theTreeImagePainteron the right edge of the cell. This constructor gives the opportunity to configure the behaviour of theTreeImagePainterand theCellPainterDecoratorfor some attributes. Remains because of downwards compatibility.- Parameters:
treeIndent- The number of pixels to indent per depth.interiorPainter- the baseICellPainterto usepaintBg- flag to configure whether theTreeImagePaintershould 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- TheICellPainterthat should be used to paint the images in the tree. Usually it is some type ofTreeImagePainterthat paints expand/collapse/leaf icons regarding the node state.
-
setBaseCellPainter
- Parameters:
cellPainter- The baseICellPainterthat should be used to render the cell content.
-
getInternalPainter
- Returns:
- The
CellPainterDecoratorthat 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:
getWrappedPainterBoundsin classCellPainterWrapper
-
paintCell
public void paintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, IConfigRegistry configRegistry) - Specified by:
paintCellin interfaceICellPainter- Overrides:
paintCellin classCellPainterWrapper
-
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- Overrides:
getPreferredWidthin 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- TheIConfigRegistryneeded 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
-