Interface TreeSelectionModel<T>

  • Type Parameters:
    T - type of node
    All Known Implementing Classes:
    DefaultTreeSelectionModel

    public interface TreeSelectionModel<T>
    Tracks which leaf nodes of a TreeModel are currently selected. The default implementation simply stores a set of unique node ids to identify selected nodes. The selection model is updated whenever the user clicks on the label for a leaf node. In the future, new methods may be added that will support selection of folders as well as leafs, and define the rules for how selections and de-selections propagate down to children or up to parents.
    Since:
    5.3
    See Also:
    Tree
    • Method Detail

      • isSelected

        boolean isSelected​(TreeNode<T> node)
        Returns true, if the given node is selected.
        Parameters:
        node - node to check
      • select

        void select​(TreeNode<T> node)
        Selects a node.
        Parameters:
        node - node to select
      • unselect

        void unselect​(TreeNode<T> node)
        Unselects a node.
        Parameters:
        node - node to unselect
      • clear

        void clear()
        Clears the selection.