Class BasicTreeNode

    • Field Detail

      • text

        protected java.lang.String text
      • imageSource

        protected java.lang.Object imageSource
      • description

        protected java.lang.String description
      • children

        protected java.util.List<TreeNode> children
      • enabled

        protected boolean enabled
      • selected

        protected boolean selected
      • visible

        protected boolean visible
      • treeSelected

        protected java.lang.String treeSelected
        Flag to indicate that any part of the sub-tree rooted at this node is selected. This value is computed on demand and cached.
    • Constructor Detail

      • BasicTreeNode

        public BasicTreeNode​(java.lang.String text)
        Create a node with text.
        Parameters:
        text - Node text.
      • BasicTreeNode

        public BasicTreeNode​(java.lang.String text,
                             java.lang.Object imageSource)
        Create a node with text and an icon.
        Parameters:
        text - Node text.
        imageSource - Image source for the node icon. May be a String, URL, or BufferedImage.
    • Method Detail

      • getText

        public java.lang.String getText()
        Get the text of this node.
        Specified by:
        getText in interface TreeNode
        Returns:
        Node text.
      • getParent

        public 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.
        Specified by:
        getParent in interface TreeNode
        Returns:
        Parent node, or null if this the root node.
        See Also:
        TreeNode.setParent(TreeNode)
      • setEnabled

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

        public void setSelected​(boolean selected)
        Set the node to selected or not selected.
        Specified by:
        setSelected in interface TreeNode
        Parameters:
        selected - New selection value.
        See Also:
        TreeNode.isSelected()
      • isLeaf

        public boolean isLeaf()
        Is the node a leaf node.
        Specified by:
        isLeaf in interface TreeNode
        Returns:
        True if this is a leaf node.
      • setVisible

        public 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.
        Specified by:
        setVisible in interface TreeNode
        Parameters:
        visible - New visibility setting.
        See Also:
        TreeNode.isVisible()
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: TreeNode
        Get extra text associated with this node.
        Specified by:
        getDescription in interface TreeNode
        Returns:
        Description of node.
      • setDescription

        public void setDescription​(java.lang.String description)
        Description copied from interface: TreeNode
        Set the node description. The description can hold any extra text associated with the node.
        Specified by:
        setDescription in interface TreeNode
        Parameters:
        description - New description.
      • getImageSource

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

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

        public 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.
        Specified by:
        hasImage in interface TreeNode
        Returns:
        True if the node has an image.
      • getTexture

        public BasicWWTexture getTexture()
        Get the texture loaded for the node's icon.
        Specified by:
        getTexture in interface TreeNode
        Returns:
        Icon texture, or null if the texture has not been loaded yet.
      • initializeTexture

        protected void initializeTexture()
        Create and initialize the texture from the image source. If the image is not in memory this method will request that it be loaded.
      • addChild

        public void addChild​(TreeNode child)
        Add a child node.
        Specified by:
        addChild in interface TreeNode
        Parameters:
        child - New child.
      • addChild

        public void addChild​(int index,
                             TreeNode child)
        Add a child node at a specified position in the list of children.
        Specified by:
        addChild in interface TreeNode
        Parameters:
        index - Index at which the new child will be inserted.
        child - New child.
      • removeChild

        public void removeChild​(TreeNode child)
        Remove a child node.
        Specified by:
        removeChild in interface TreeNode
        Parameters:
        child - Child to remove.
      • removeAllChildren

        public void removeAllChildren()
        Remove all of the child nodes from this node.
        Specified by:
        removeAllChildren in interface TreeNode
      • getPath

        public TreePath getPath()
        Get the path from the root node to this node.
        Specified by:
        getPath in interface TreeNode
        Returns:
        Tree path to this node.
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent propertyChangeEvent)
        The property change listener for this instance. Receives property change notifications that this instance has registered with other property change notifiers.
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
        Overrides:
        propertyChange in class WWObjectImpl
        Parameters:
        propertyChangeEvent - the event