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
| Visibility | Signature |
|---|---|
| public | JtvOutline(JtvRect bounds, JtvScrollBar aHScrollBar, JtvScrollBar aVScrollBar, JtvNode aRoot) |
Fields
| Modifiers | Field name | Type |
|---|---|---|
| private | root | org.viktor44.jtvision.views.JtvNode |
Methods
| Modifiers | Method signature | Return type |
|---|---|---|
| public | adjust(JtvNode node, boolean expand) | void |
| public | getNumChildren(JtvNode node) | int |
| public | getNext(JtvNode node) | org.viktor44.jtvision.views.JtvNode |
| public | getChild(JtvNode node, int i) | org.viktor44.jtvision.views.JtvNode |
| public | getText(JtvNode node) | String |
| public | isExpanded(JtvNode node) | boolean |
| public | hasChildren(JtvNode node) | boolean |
| public | getRoot() | 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 rectangleaHScrollBar- the horizontal scroll bar, ornullaVScrollBar- the vertical scroll bar, ornullaRoot- the root of the node tree, ornullfor 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;nullis a no-opexpand-trueto expand,falseto 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;nullreturns0
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;nullreturnsnull
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;nullreturnsnulli- 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;nullreturns 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;nullreturnsfalse
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;nullreturnsfalse
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().