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 a
GridColumn
-
Field Summary
Fields Modifier and Type Field Description static int
ASCENDER
A vertical bar from the top to the togglestatic int
DESCENDER
A vertical bar from the toggle to the bottomstatic int
H_CENTRE_TOGGLE
A horizontal bar from the centre to the togglestatic int
H_FULL
A full-width horizontal barstatic int
H_LEFT_TOGGLE
A horizontal bar from the left to the togglestatic int
H_RIGHT
A horizontal bar from the centre to the rightstatic int
I
Indicates that a branch should be rendered as a 'I' shape.static int
L
Indicates that a branch should be rendered as an 'L' shape.static int
LAST_ROOT
Indicates that the decoration for the last root node should be drawnstatic int
LEAF
Indicates that the decoration for a leaf node should be drawnstatic int
NODE
Indicates that the toggle decoration for an expanded parent should be drawnstatic int
NONE
Indicates that a branch should not be rendered.static int
ROOT
Indicates that the decoration for a root node should be drawnstatic int
SMALL_L
A half-width L used on roots with no childrenstatic int
SMALL_T
A half-width T used on roots with no childrenstatic int
T
Indicates that a branch should be rendered as a 'T' shape.static int
V_FULL
A full-height vertical barstatic int
V_TOP
A vertical bar from the top to the middle -
Constructor Summary
Constructors Constructor Description BranchRenderer()
-
Method Summary
Modifier and Type Method Description 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.void
paint(org.eclipse.swt.graphics.GC gc, java.lang.Object value)
Paints the visual representation of the given value on the given GC.void
setBranches(int[] branches)
Sets the branches that will be used.void
setIndent(int toggleIndent)
Sets the indent used for rendering the tree branchesvoid
setToggleBounds(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 Details
-
H_FULL
public static final int H_FULLA full-width horizontal bar- See Also:
- Constant Field Values
-
H_RIGHT
public static final int H_RIGHTA horizontal bar from the centre to the right- See Also:
- Constant Field Values
-
H_CENTRE_TOGGLE
public static final int H_CENTRE_TOGGLEA horizontal bar from the centre to the toggle- See Also:
- Constant Field Values
-
H_LEFT_TOGGLE
public static final int H_LEFT_TOGGLEA horizontal bar from the left to the toggle- See Also:
- Constant Field Values
-
V_FULL
public static final int V_FULLA full-height vertical bar- See Also:
- Constant Field Values
-
V_TOP
public static final int V_TOPA vertical bar from the top to the middle- See Also:
- Constant Field Values
-
DESCENDER
public static final int DESCENDERA vertical bar from the toggle to the bottom- See Also:
- Constant Field Values
-
ASCENDER
public static final int ASCENDERA vertical bar from the top to the toggle- See Also:
- Constant Field Values
-
NONE
public static final int NONEIndicates that a branch should not be rendered.- See Also:
- Constant Field Values
-
T
public static final int TIndicates 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 LIndicates 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 IIndicates 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 NODEIndicates that the toggle decoration for an expanded parent should be drawn- See Also:
- Constant Field Values
-
LEAF
public static final int LEAFIndicates that the decoration for a leaf node should be drawn- See Also:
- Constant Field Values
-
ROOT
public static final int ROOTIndicates that the decoration for a root node should be drawn- See Also:
- Constant Field Values
-
LAST_ROOT
public static final int LAST_ROOTIndicates that the decoration for the last root node should be drawn- See Also:
- Constant Field Values
-
SMALL_T
public static final int SMALL_TA half-width T used on roots with no children- See Also:
- Constant Field Values
-
SMALL_L
public static final int SMALL_LA half-width L used on roots with no children- See Also:
- Constant Field Values
-
-
Constructor Details
-
BranchRenderer
public BranchRenderer()
-
-
Method Details
-
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
Transform
to 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
-