Package com.tonic.vellum.widget
Class TreeView
- java.lang.Object
-
- com.tonic.vellum.Section
-
- com.tonic.vellum.widget.AbstractListSection
-
- com.tonic.vellum.widget.TreeView
-
public final class TreeView extends AbstractListSection
A scrollable tree view that flattens the expanded nodes to rows; activation toggles a parent or selects a leaf, and LEFT/RIGHT collapse and expand the node under the cursor.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TreeViewonSelectNode(java.util.function.Consumer<TreeNode> handler)Sets the handler invoked with a leaf node when it is activated.TreeViewrefresh()Re-flattens the visible rows after the tree is mutated outside the view.TreeNodeselectedNode()-
Methods inherited from class com.tonic.vellum.widget.AbstractListSection
onHighlight, onSelect, select, selectedIndex
-
-
-
-
Constructor Detail
-
TreeView
public TreeView(TreeNode root)
Creates a tree view showing the root node.- Parameters:
root- the root node of the tree
-
TreeView
public TreeView(TreeNode root, boolean showRoot)
Creates a tree view, optionally hiding the root node.- Parameters:
root- the root node of the treeshowRoot-trueto show the root row,falseto show only its children
-
-
Method Detail
-
onSelectNode
public TreeView onSelectNode(java.util.function.Consumer<TreeNode> handler)
Sets the handler invoked with a leaf node when it is activated.- Parameters:
handler- the selection handler- Returns:
- this TreeView for chaining
-
refresh
public TreeView refresh()
Re-flattens the visible rows after the tree is mutated outside the view.- Returns:
- this TreeView for chaining
-
selectedNode
public TreeNode selectedNode()
- Returns:
- the node under the cursor, or null if there is no selection
-
-