Class 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.
    • 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 tree
        showRoot - true to show the root row, false to 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