Interface TreeNodeModel<V>

    • Field Detail

      • EXPANDED_PROPERTY

        static final java.lang.String EXPANDED_PROPERTY
        The expanded bound property.
    • Method Detail

      • isExpanded

        boolean isExpanded()
        Returns:
        Whether the node is expanded, showing its children, if any.
      • setExpanded

        void setExpanded​(boolean newExpanded)
        Sets whether the node is expanded, showing its children, if any. This is a bound property of type Boolean.
        Parameters:
        newExpanded - true if the node is expanded.
        See Also:
        EXPANDED_PROPERTY
      • setAllExpanded

        void setAllExpanded​(boolean newAllExpanded)
        Sets whether all tree nodes, including this node, are expanded in this subtree.
        Parameters:
        newAllExpanded - true if all the nodes in this tree should be expanded, or false if they should be collapsed.
        See Also:
        setExpanded(boolean)
      • isLeaf

        boolean isLeaf()
        Determines whether this node could be considered a leaf node. This method may return false even if it currently has no children, if it intends to load them later and there is no way to know ahead of time if there will be children.
        Returns:
        true if this is a leaf node, else false if this node should not be considered a leaf.
      • hasChildren

        boolean hasChildren()
        Returns:
        Whether this tree node has children. This implementation delegates to the tree node list.
      • hasChild

        boolean hasChild​(TreeNodeModel<?> treeNode)
        Determines whether this tree node contains the given child tree node.
        Parameters:
        treeNode - The tree node to check.
        Returns:
        true if this tree node contains the given tree node.
      • add

        void add​(TreeNodeModel<?> treeNode)
        Adds a child tree node to this tree node.
        Parameters:
        treeNode - The tree node to add.
        Throws:
        java.lang.IllegalArgumentException - if the tree node already has a parent.
      • remove

        void remove​(TreeNodeModel<?> treeNode)
        Removes a child tree node from this tree node.
        Parameters:
        treeNode - The child tree node to remove.
        Throws:
        java.lang.IllegalArgumentException - if the tree node is not a child of this tree node.
      • clear

        void clear()
        Removes all of the child tree nodes from this tree node.
      • getParent

        TreeNodeModel<?> getParent()
        Returns:
        The parent of this node, or null if this node has no parent.
      • setParent

        void setParent​(TreeNodeModel<?> newParent)
        Sets the parent of this tree node. This method is managed by other tree nodes, and normally should not be called by applications. A tree node cannot be given a parent if it already has a parent. A tree node's parent cannot be removed this component is still a child of that parent. A tree node's parent cannot be set unless that parent already recognizes this tree node as one of its children. If a tree node is given the same parent it already has, no action occurs.
        Parameters:
        newParent - The new parent for this tree node, or null if this tree node is being removed from a parent.
        Throws:
        java.lang.IllegalStateException - if a parent is provided and this tree node already has a parent.
        java.lang.IllegalStateException - if no parent is provided and this tree node's old parent still recognizes this tree node as its child.
        java.lang.IllegalArgumentException - if a parent is provided and the given parent does not already recognize this tree node as its child.
        See Also:
        add(TreeNodeModel), remove(TreeNodeModel)
      • getDepth

        int getDepth()
        Returns the zero-based depth of the node within in its tree. This result represents the number of levels above this node needed to reach the root node.
        Returns:
        The zero-based depth of this node from the root.