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:
  • Constructor Details

  • Method Details

    • setTreeRoot

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

      The initial value is null.

    • getTreeRoot

      public WTreeNode getTreeRoot()
      Returns the root node.

      See Also:
    • setSelectionMode

      public void setSelectionMode(SelectionMode mode)
      Sets the selection mode.

      The default selection mode is SelectionMode.None.

    • getSelectionMode

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

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

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

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

      public final void select(WTreeNode node)
      Selects or unselect the given node.

      Calls select(node, true)

    • 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.