Interface TreeNode

    • Field Detail

      • SELECTED

        static final java.lang.String SELECTED
        All nodes in a subtree are selected.
        See Also:
        Constant Field Values
      • NOT_SELECTED

        static final java.lang.String NOT_SELECTED
        No nodes in a subtree are selected.
        See Also:
        Constant Field Values
      • PARTIALLY_SELECTED

        static final java.lang.String PARTIALLY_SELECTED
        Some nodes in a subtree are selected, and some are not.
        See Also:
        Constant Field Values
    • Method Detail

      • getText

        java.lang.String getText()
        Get the text of this node.
        Returns:
        Node text.
      • getDescription

        java.lang.String getDescription()
        Get extra text associated with this node.
        Returns:
        Description of node.
      • setDescription

        void setDescription​(java.lang.String description)
        Set the node description. The description can hold any extra text associated with the node.
        Parameters:
        description - New description.
      • getParent

        TreeNode getParent()
        Get the node's parent. Each node in the tree has a parent, except for the root node. The parent of the root node is null.
        Returns:
        Parent node, or null if this the root node.
        See Also:
        setParent(TreeNode)
      • setParent

        void setParent​(TreeNode node)
        Set the parent node.
        Parameters:
        node - New parent node.
        See Also:
        getParent()
      • getChildren

        java.lang.Iterable<TreeNode> getChildren()
        Get the children of this node.
        Returns:
        Child nodes, or an empty iterator if the node does not have children.
        See Also:
        addChild(TreeNode)
      • isEnabled

        boolean isEnabled()
        Is the node enabled?
        Returns:
        True if the node is enabled.
        See Also:
        setEnabled(boolean)
      • setEnabled

        void setEnabled​(boolean enabled)
        Set the node to enabled or not enabled. A node that is not enabled will not respond to user input.
        Parameters:
        enabled - New enabled state.
        See Also:
        isEnabled()
      • setSelected

        void setSelected​(boolean selected)
        Set the node to selected or not selected.
        Parameters:
        selected - New selection value.
        See Also:
        isSelected()
      • isVisible

        boolean isVisible()
        Is the node visible?
        Returns:
        True if the node is visible.
        See Also:
        setVisible(boolean)
      • setVisible

        void setVisible​(boolean visible)
        Set the node to visible or not visible. If the node is not visible it will not be drawn by the tree layout.
        Parameters:
        visible - New visibility setting.
        See Also:
        isVisible()
      • isLeaf

        boolean isLeaf()
        Is the node a leaf node.
        Returns:
        True if this is a leaf node.
      • addChild

        void addChild​(TreeNode child)
        Add a child node.
        Parameters:
        child - New child.
      • addChild

        void addChild​(int index,
                      TreeNode child)
               throws java.lang.IndexOutOfBoundsException
        Add a child node at a specified position in the list of children.
        Parameters:
        index - Index at which the new child will be inserted.
        child - New child.
        Throws:
        java.lang.IndexOutOfBoundsException - if index is less than zero or greater than the number of children already in the list.
      • removeChild

        void removeChild​(TreeNode child)
        Remove a child node.
        Parameters:
        child - Child to remove.
      • removeAllChildren

        void removeAllChildren()
        Remove all of the child nodes from this node.
      • getPath

        TreePath getPath()
        Get the path from the root node to this node.
        Returns:
        Tree path to this node.
      • getImageSource

        java.lang.Object getImageSource()
        Get the source of the node icon.
        Returns:
        Image source of the icon. null if the node does not have an icon.
      • setImageSource

        void setImageSource​(java.lang.Object imageSource)
        Set the node's icon.
        Parameters:
        imageSource - New icon source. May be a String, URL, or BufferedImage.
      • hasImage

        boolean hasImage()
        Does this node have an icon? This method returns true if an image source has been set. The method returns true even if the image has not been fully loaded.
        Returns:
        True if the node has an image.
      • getTexture

        WWTexture getTexture()
        Get the texture loaded for the node's icon.
        Returns:
        Icon texture, or null if the texture has not been loaded yet.