TreeNode (record)

Fundamental building block for tree structures.

Wraps a node value and holds references to related nodes.

API

TreeNode.java
record TreeNode<T> {
  TreeNode<T> root(T rootValue, TreeAdapter<T> treeAdapter)     (1)
  TreeNode<T> root(T rootValue, Class<? extends TreeAdapter<T>> treeAdapterClass, FactoryService factoryService)     (2)
  TreeNode<T> root(T rootValue, Class<? extends TreeAdapter<T>> treeAdapterClass, TreeState sharedState, FactoryService factoryService)
  TreeNode<T> root(T rootValue, TreeAdapter<T> treeAdapter, TreeState sharedState)
  String toString()
  boolean equals(Object obj)
  int hashCode()
  TreeNode<T> rootNode()
  T rootValue()
  int incomingCount()
  int outgoingCount()
  Stream<Edge<T>> streamIncoming()
  Stream<Edge<T>> streamOutgoing()
  Optional<TreeNode<T>> resolve(TreePath absolutePath)     (3)
  Optional<TreeNode<T>> lookupParent()
  int childCount()
  Stream<TreeNode<T>> streamChildren()
  boolean isRoot()
  boolean isLeaf()
  boolean isExpanded(TreePath treePath)
  TreeNode<T> expand(TreePath... treePaths)     (4)
  TreeNode<T> expand()     (5)
  TreeNode<T> collapse(TreePath... treePaths)     (6)
  TreeNode<T> clearSelection()     (7)
  boolean isSelected(TreePath treePath)     (8)
  TreeNode<T> select(TreePath... treePaths)     (9)
  Iterator<TreeNode<T>> iteratorHierarchyUp()
  Stream<TreeNode<T>> streamHierarchyUp()
  Iterator<TreeNode<T>> iteratorDepthFirst()
  Iterator<TreeNode<T>> iteratorBreadthFirst()
  Stream<TreeNode<T>> streamDepthFirst()
  Stream<TreeNode<T>> streamBreadthFirst()
}
1 root(T, TreeAdapter)

Creates the root node of a tree structure as inferred from given treeAdapter.

2 root(T, Class, FactoryService)

Creates the root node of a tree structure as inferred from given treeAdapter.

3 resolve(TreePath)

Resolves given path relative to the root of this tree.

4 expand(TreePath)

Adds treePaths to the set of expanded nodes, as held by this tree’s shared state object.

5 expand()

Expands this node and all its parents.

6 collapse(TreePath)

Removes treePaths from the set of expanded nodes, as held by this tree’s shared state object.

7 clearSelection()

Clears all selection markers.

8 isSelected(TreePath)

Whether node that corresponds to given TreePath has a selection marker.

9 select(TreePath)

Select nodes by their corresponding TreePath , that is, activate their selection marker.

Members

root(T, TreeAdapter)

Creates the root node of a tree structure as inferred from given treeAdapter.

root(T, Class, FactoryService)

Creates the root node of a tree structure as inferred from given treeAdapter.

resolve(TreePath)

Resolves given path relative to the root of this tree.

expand(TreePath)

Adds treePaths to the set of expanded nodes, as held by this tree’s shared state object.

expand()

Expands this node and all its parents.

collapse(TreePath)

Removes treePaths from the set of expanded nodes, as held by this tree’s shared state object.

clearSelection()

Clears all selection markers.

isSelected(TreePath)

Whether node that corresponds to given TreePath has a selection marker.

select(TreePath)

Select nodes by their corresponding TreePath , that is, activate their selection marker.

With the Wicket Viewer corresponds to expressing CSS class tree-node-selected on the rendered tree node, which has default bg-color lightgrey . Color can be customized by setting CSS var __

.tree-theme-bootstrap .tree-node-selected {
    background-color: var(--tree-node-selected-bg-color, lightgrey);
}