Skip to content

TreeView

Hierarchical tree container rendering collapsable nodes with custom icons, inline editing, and selection.

Overview

Hierarchical tree container rendering collapsable nodes with custom icons, inline editing, and selection. Provides extensive layout configuration and interaction capabilities.

Basic Usage

TreeView tree = new TreeView();
TreeViewNode root = tree.addRoot("Project");
root.addChild("src");
root.addChild("build.gradle");
  • TreeList: Specialized TreeView for hierarchical path navigation and directory listing.

API

TreeView()

Constructs an empty TreeView container.

TreeView::addRoot(RichText)

Creates and appends a new root node with RichText label.

Parameter Type Description
text RichText The rich text label.

Returns TreeViewNode: The tree node instance..

TreeView::addRoot(String)

Creates and appends a new root node with plain text label.

Parameter Type Description
text String The text label.

Returns TreeViewNode: The tree node instance..

TreeView::addRoot(TreeViewNode)

Appends an existing node as a root.

Parameter Type Description
node TreeViewNode The tree node instance.

Returns TreeView: This instance for chaining..

TreeView::beginBatch()

Begins a batch update session, suppressing layout recalculations until endBatch is called.

Returns TreeView: This instance for chaining..

TreeView::cancelEditing()

Cancels the active inline node edit session without committing changes.

TreeView::clearRoots()

Removes all root nodes from the tree.

Returns TreeView: This instance for chaining..

TreeView::clearSelection()

Clears any current node selection.

Returns TreeView: This instance for chaining..

TreeView::editingNode()

Returns the node currently being edited in-place, or null if not editing.

Returns TreeViewNode: The node currently being edited, or null..

TreeView::endBatch()

Ends a batch update session, triggering row rebuilding if mutations occurred.

Returns TreeView: This instance for chaining..

TreeView::hoverScrollSpeed()

Returns the text hover scrolling speed.

Returns float: The hover scroll speed in pixels per second..

TreeView::hoverScrollSpeed(float)

Sets the text hover scrolling speed.

Parameter Type Description
pixelsPerSecond float The scroll speed in pixels per second.

Returns TreeView: This instance for chaining..

TreeView::iconMode()

Returns the current tree icon display mode.

Returns TreeIconMode: The tree icon mode..

TreeView::iconMode(TreeIconMode)

Sets the tree icon display mode.

Parameter Type Description
iconMode TreeIconMode The tree icon mode.

Returns TreeView: This instance for chaining..

TreeView::insertRoot(int, TreeViewNode)

Inserts a root node at the specified index.

Parameter Type Description
index int The index position.
node TreeViewNode The tree node instance.

Returns TreeView: This instance for chaining..

TreeView::isBatching()

Returns true if batch mode is currently active.

Returns boolean: True if batch updates are active..

TreeView::isEditing()

Returns true if an inline node label edit operation is active.

Returns boolean: True if inline editing is active..

TreeView::onRowCreated()

Returns the row creation callback listener.

Returns Consumer: The result value..

TreeView::onRowCreated(Consumer)

Registers a listener invoked whenever a row button is instantiated or re-bound.

Parameter Type Description
listener Consumer The event listener callback.

Returns TreeView: This instance for chaining..

TreeView::onSelectionChanged(EventListener)

Registers a listener called when node selection changes.

Parameter Type Description
listener EventListener The event listener callback.

Returns EventSubscription: The event subscription handle..

TreeView::removeRoot(TreeViewNode)

Removes the specified root node from the tree.

Parameter Type Description
node TreeViewNode The tree node instance.

Returns TreeView: This instance for chaining..

TreeView::root(int)

Returns the root node at the specified index.

Parameter Type Description
index int The index position.

Returns TreeViewNode: The root node at the specified index..

TreeView::rootCount()

Returns the total number of root nodes.

Returns int: The number of root nodes..

TreeView::roots()

Returns an unmodifiable list of top-level root nodes.

Returns List: An unmodifiable list of root nodes..

TreeView::rowTextHoverScrollSpeed()

Returns the text hover scrolling speed in pixels per second for overflowing node labels.

Returns float: The hover scroll speed in pixels per second..

TreeView::rowTextHoverScrollSpeed(float)

Sets the text hover scrolling speed in pixels per second.

Parameter Type Description
pixelsPerSecond float The scroll speed in pixels per second.

Returns TreeView: This instance for chaining..

TreeView::rowsHost()

Returns the vertical container hosting row button widgets.

Returns VBox: The container hosting tree row buttons..

TreeView::select(TreeViewNode)

Selects the specified node and fires a selection change event.

Parameter Type Description
node TreeViewNode The tree node instance.

Returns TreeView: This instance for chaining..

TreeView::selectedIndex()

Returns the visible index of the currently selected node.

Returns int: The selected index, or -1 if none..

TreeView::selectedNode()

Returns the currently selected tree node, or null if none.

Returns TreeViewNode: The currently selected node, or null..

TreeView::selectedPath()

Returns the hierarchical index path of the currently selected node.

Returns List: The index path of the selected node..

TreeView::silentSelect(TreeViewNode)

Selects the specified node without emitting a selection change event.

Parameter Type Description
node TreeViewNode The tree node instance.

Returns TreeView: This instance for chaining..

TreeView::startEditing(TreeViewNode, Consumer)

Starts inline text editing for the specified node with default input configuration.

Parameter Type Description
node TreeViewNode The tree node instance.
onCommit Consumer The commit callback on editing completion.

TreeView::startEditing(TreeViewNode, Consumer, Consumer)

Starts inline text editing for the specified node with custom text input configuration and commit callback.

Parameter Type Description
node TreeViewNode The tree node instance.
config Consumer The text input configuration callback.
onCommit Consumer The commit callback on editing completion.

TreeView::stopEditing()

Commits and closes the active inline node edit session.

TreeView::visibleNodes()

Returns an unmodifiable list of currently visible (flattened) tree nodes.

Returns List: An unmodifiable list of visible nodes..