Class WTree


  • public class WTree
    extends WCompositeWidget
    A widget that represents a navigatable tree.

    WTree provides a tree widget, and coordinates selection functionality.

    Unlike the MVC-based WTreeView, the tree renders a widget hierarchy, rather than a hierarhical standard model. This provides extra flexibility (as any widget can be used as contents), at the cost of server-side, client-side and bandwidth resources (especially for large tree tables).

    The tree is implemented as a hierarchy of WTreeNode widgets.

    Selection is rendered by calling renderSelected(). Only tree nodes that are selectable may participate in the selection.

    A screenshot of the tree:

    An example WTree (default)

    An example WTree (polished)

    See Also:
    WTreeNode, WTreeTable, WTreeView
    • Method Detail

      • setTreeRoot

        public void setTreeRoot​(WTreeNode node)
        Sets the tree root node.

        The initial value is null.

      • getSelectionMode

        public SelectionMode getSelectionMode()
        Returns the selection mode.
      • getSelectedNodes

        public java.util.Set<WTreeNode> getSelectedNodes()
        Returns the set of selected tree nodes.
      • select

        public void select​(java.util.Set<WTreeNode> nodes)
        Sets a selection of tree nodes.
      • select

        public void select​(WTreeNode node,
                           boolean selected)
        Selects or unselect the given node.
      • isSelected

        public boolean isSelected​(WTreeNode node)
        Returns if the given node is currently selected.
      • clearSelection

        public void clearSelection()
        Clears the current selection.
      • itemSelectionChanged

        public Signal itemSelectionChanged()
        Signal that is emitted when the selection changes.