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 toggle
    static int DESCENDER
    A vertical bar from the toggle to the bottom
    static int H_CENTRE_TOGGLE
    A horizontal bar from the centre to the toggle
    static int H_FULL
    A full-width horizontal bar
    static int H_LEFT_TOGGLE
    A horizontal bar from the left to the toggle
    static int H_RIGHT
    A horizontal bar from the centre to the right
    static 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 drawn
    static int LEAF
    Indicates that the decoration for a leaf node should be drawn
    static int NODE
    Indicates that the toggle decoration for an expanded parent should be drawn
    static int NONE
    Indicates that a branch should not be rendered.
    static int ROOT
    Indicates that the decoration for a root node should be drawn
    static int SMALL_L
    A half-width L used on roots with no children
    static int SMALL_T
    A half-width T used on roots with no children
    static int T
    Indicates that a branch should be rendered as a 'T' shape.
    static int V_FULL
    A full-height vertical bar
    static 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 branches
    void setToggleBounds​(org.eclipse.swt.graphics.Rectangle toggleBounds)
    Sets bounds of the toggle control.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • 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 extents
      hint - 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 with
      value - 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