Skip to main content

Class JtvOutline

public class JtvOutline
extends JtvOutlineViewer

A concrete JtvOutlineViewer backed by a JtvNode linked tree.

JtvOutline wires the abstract tree-model methods of JtvOutlineViewer to the JtvNode data structure. The tree root is stored in root; siblings are linked via JtvNode.getNext(), and children are linked via JtvNode.getChildList().

Expand/collapse state is maintained on each JtvNode directly through JtvNode.setExpanded(boolean) and JtvNode.isExpanded().

After construction, JtvOutlineViewer.update() is called automatically to compute the initial scroll limit and focus position.

org.viktor44.jtvision.views.JtvOutline

Summary​

Constructors​

VisibilitySignature
publicJtvOutline(JtvRect bounds, JtvScrollBar aHScrollBar, JtvScrollBar aVScrollBar, JtvNode aRoot)

Fields​

ModifiersField nameType
privaterootorg.viktor44.jtvision.views.JtvNode

Methods​

ModifiersMethod signatureReturn type
publicadjust(JtvNode node, boolean expand)void
publicgetNumChildren(JtvNode node)int
publicgetNext(JtvNode node)org.viktor44.jtvision.views.JtvNode
publicgetChild(JtvNode node, int i)org.viktor44.jtvision.views.JtvNode
publicgetText(JtvNode node)String
publicisExpanded(JtvNode node)boolean
publichasChildren(JtvNode node)boolean
publicgetRoot()org.viktor44.jtvision.views.JtvNode

Constructors​

JtvOutline(JtvRect bounds, JtvScrollBar aHScrollBar, JtvScrollBar aVScrollBar, JtvNode aRoot)​

Constructs a TOutline with the given bounds, scroll bars, and root node. Calls JtvOutlineViewer.update() to initialise the scroll limit.

Parameters

  • bounds - the bounding rectangle
  • aHScrollBar - the horizontal scroll bar, or null
  • aVScrollBar - the vertical scroll bar, or null
  • aRoot - the root of the node tree, or null for empty

Fields​

org.viktor44.jtvision.views.JtvNode root​

The root node of the displayed tree. The remaining top-level nodes are reachable via successive calls to JtvNode.getNext().

Methods​

adjust(JtvNode node, boolean expand)​

Overrides:

adjust(JtvNode node, boolean expand) in org.viktor44.jtvision.views.JtvOutlineViewer

Expands or collapses node by calling JtvNode.setExpanded(boolean).

Parameters

  • node - the node to adjust; null is a no-op
  • expand - true to expand, false to collapse

getNumChildren(JtvNode node)​

Overrides:

getNumChildren(JtvNode node) in org.viktor44.jtvision.views.JtvOutlineViewer

Returns the number of direct children of node by walking node.childList via JtvNode.getNext().

Parameters

  • node - the node to query; null returns 0

Returns

the child count

getNext(JtvNode node)​

Overrides:

getNext(JtvNode node) in org.viktor44.jtvision.views.JtvOutlineViewer

Returns the next sibling of node via JtvNode.getNext().

Parameters

  • node - the reference node; null returns null

Returns

the next sibling, or null

getChild(JtvNode node, int i)​

Overrides:

getChild(JtvNode node, int i) in org.viktor44.jtvision.views.JtvOutlineViewer

Returns the i-th child of node by walking node.childList i steps via JtvNode.getNext().

Parameters

  • node - the parent node; null returns null
  • i - the zero-based child index

Returns

the child at index i, or null if out of range

getText(JtvNode node)​

Overrides:

getText(JtvNode node) in org.viktor44.jtvision.views.JtvOutlineViewer

Returns the display text of node via JtvNode.getText().

Parameters

  • node - the node to describe; null returns an empty string

Returns

the node's text label, or ""

isExpanded(JtvNode node)​

Overrides:

isExpanded(JtvNode node) in org.viktor44.jtvision.views.JtvOutlineViewer

Returns true if node is expanded.

Parameters

  • node - the node to test; null returns false

Returns

true if the node is expanded

hasChildren(JtvNode node)​

Overrides:

hasChildren(JtvNode node) in org.viktor44.jtvision.views.JtvOutlineViewer

Returns true if node has at least one child (i.e. node.childList is non-null).

Parameters

  • node - the node to test; null returns false

Returns

true if the node has children

getRoot()​

Overrides:

getRoot() in org.viktor44.jtvision.views.JtvOutlineViewer

The root node of the displayed tree. The remaining top-level nodes are reachable via successive calls to JtvNode.getNext().