Class BranchRenderer
- java.lang.Object
-
- org.eclipse.nebula.widgets.grid.AbstractRenderer
-
- org.eclipse.nebula.widgets.grid.internal.BranchRenderer
-
- All Implemented Interfaces:
IRenderer
public class BranchRenderer extends AbstractRenderer
Renders the tree branch hierarchy for aGridColumn
-
-
Field Summary
Fields Modifier and Type Field Description static intASCENDERA vertical bar from the top to the toggleprivate int[]branchesstatic intDESCENDERA vertical bar from the toggle to the bottomstatic intH_CENTRE_TOGGLEA horizontal bar from the centre to the togglestatic intH_FULLA full-width horizontal barstatic intH_LEFT_TOGGLEA horizontal bar from the left to the togglestatic intH_RIGHTA horizontal bar from the centre to the rightstatic intIIndicates that a branch should be rendered as a 'I' shape.private intindentstatic intLIndicates that a branch should be rendered as an 'L' shape.static intLAST_ROOTIndicates that the decoration for the last root node should be drawnstatic intLEAFIndicates that the decoration for a leaf node should be drawnprivate static int[]LINE_STYLEstatic intNODEIndicates that the toggle decoration for an expanded parent should be drawnstatic intNONEIndicates that a branch should not be rendered.static intROOTIndicates that the decoration for a root node should be drawnstatic intSMALL_LA half-width L used on roots with no childrenstatic intSMALL_TA half-width T used on roots with no childrenstatic intTIndicates that a branch should be rendered as a 'T' shape.private org.eclipse.swt.graphics.RectangletoggleBoundsstatic intV_FULLA full-height vertical barstatic intV_TOPA vertical bar from the top to the middle
-
Constructor Summary
Constructors Constructor Description BranchRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.swt.graphics.PointcomputeSize(org.eclipse.swt.graphics.GC gc, int hint, int hint2, java.lang.Object value)Returns the size of the given value's visual representation.voidpaint(org.eclipse.swt.graphics.GC gc, java.lang.Object value)Paints the visual representation of the given value on the given GC.voidsetBranches(int[] branches)Sets the branches that will be used.voidsetIndent(int toggleIndent)Sets the indent used for rendering the tree branchesvoidsetToggleBounds(org.eclipse.swt.graphics.Rectangle toggleBounds)Sets bounds of the toggle control.-
Methods inherited from class org.eclipse.nebula.widgets.grid.AbstractRenderer
getBounds, getDisplay, getSize, isExpanded, isFocus, isHover, isMouseDown, isSelected, setBounds, setBounds, setDisplay, setExpanded, setFocus, setHover, setLocation, setLocation, setMouseDown, setSelected, setSize, setSize
-
-
-
-
Field Detail
-
LINE_STYLE
private static final int[] LINE_STYLE
-
H_FULL
public static final int H_FULL
A full-width horizontal bar- See Also:
- Constant Field Values
-
H_RIGHT
public static final int H_RIGHT
A horizontal bar from the centre to the right- See Also:
- Constant Field Values
-
H_CENTRE_TOGGLE
public static final int H_CENTRE_TOGGLE
A horizontal bar from the centre to the toggle- See Also:
- Constant Field Values
-
H_LEFT_TOGGLE
public static final int H_LEFT_TOGGLE
A horizontal bar from the left to the toggle- See Also:
- Constant Field Values
-
V_FULL
public static final int V_FULL
A full-height vertical bar- See Also:
- Constant Field Values
-
V_TOP
public static final int V_TOP
A vertical bar from the top to the middle- See Also:
- Constant Field Values
-
DESCENDER
public static final int DESCENDER
A vertical bar from the toggle to the bottom- See Also:
- Constant Field Values
-
ASCENDER
public static final int ASCENDER
A vertical bar from the top to the toggle- See Also:
- Constant Field Values
-
NONE
public static final int NONE
Indicates that a branch should not be rendered.- See Also:
- Constant Field Values
-
T
public static final int T
Indicates that a branch should be rendered as a 'T' shape. This is used for normal children with following siblings- See Also:
- Constant Field Values
-
L
public static final int L
Indicates that a branch should be rendered as an 'L' shape. This is used for the last child element- See Also:
- Constant Field Values
-
I
public static final int I
Indicates that a branch should be rendered as a 'I' shape. This is used for connecting children when intermediate children are shown.- See Also:
- Constant Field Values
-
NODE
public static final int NODE
Indicates that the toggle decoration for an expanded parent should be drawn- See Also:
- Constant Field Values
-
LEAF
public static final int LEAF
Indicates that the decoration for a leaf node should be drawn- See Also:
- Constant Field Values
-
ROOT
public static final int ROOT
Indicates that the decoration for a root node should be drawn- See Also:
- Constant Field Values
-
LAST_ROOT
public static final int LAST_ROOT
Indicates that the decoration for the last root node should be drawn- See Also:
- Constant Field Values
-
SMALL_T
public static final int SMALL_T
A half-width T used on roots with no children- See Also:
- Constant Field Values
-
SMALL_L
public static final int SMALL_L
A half-width L used on roots with no children- See Also:
- Constant Field Values
-
indent
private int indent
-
branches
private int[] branches
-
toggleBounds
private org.eclipse.swt.graphics.Rectangle toggleBounds
-
-
Method Detail
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.graphics.GC gc, int hint, int hint2, java.lang.Object value)Returns the size of the given value's visual representation.- Parameters:
gc- convenience GC for string and text extentshint- given width (or SWT.DEFAULT)hint2- given height (or SWT.DEFAULT)value- value to be sized- Returns:
- the size
-
paint
public void paint(org.eclipse.swt.graphics.GC gc, java.lang.Object value)Paints the visual representation of the given value on the given GC. The actual class of the value object is determined by the use of the implementing class.Implementors need to respect the bounds values that may have been specified. The bounds values may affect the x and y values for all drawing operations as well as the width and heights. Implementors may use a
Transformto translate the coordinates of all the drawing operations, otherwise they will need to offset each draw.- Parameters:
gc- GC to paint withvalue- the value being painted
-
setBranches
public void setBranches(int[] branches)
Sets the branches that will be used. The values are taken from the constants in this class such as I, L, T, NODE, LEAF and NONE, which represent the branch type to be used for each level.- Parameters:
branches- an array of branch types
-
setIndent
public void setIndent(int toggleIndent)
Sets the indent used for rendering the tree branches- Parameters:
toggleIndent- the indent used for the tree
-
setToggleBounds
public void setToggleBounds(org.eclipse.swt.graphics.Rectangle toggleBounds)
Sets bounds of the toggle control. This is used to position the downwards branches- Parameters:
toggleBounds- the bounds of the toggle control
-
-