Class NamedTreeNode<E extends NamedObject>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<NamedTreeNode<E>>, javax.swing.tree.TreeNode

    public class NamedTreeNode<E extends NamedObject>
    extends java.lang.Object
    implements javax.swing.tree.TreeNode, java.lang.Comparable<NamedTreeNode<E>>, java.io.Serializable
    TreeNode implementation for Named Objects (like arches, faces, animations, artifacts etc.), used for displaying faces in a JTree.
    See Also:
    Serialized Form
    • Constructor Detail

      • NamedTreeNode

        public NamedTreeNode()
        Creates a root node. All other nodes must be created via append(NamedObject).
    • Method Detail

      • getNamedObject

        @Nullable
        public @Nullable NamedObject getNamedObject()
        Returns the AbstractNamedObject of this node. Only returns an object for leaf nodes. For dir nodes, it returns null
        Returns:
        the abstract named object of leaf node / null for dir nodes
      • getName

        @NotNull
        public @NotNull java.lang.String getName()
        Returns the name.
        Returns:
        the name
      • children

        @NotNull
        public @NotNull java.util.Enumeration<NamedTreeNode<E>> children()
        Specified by:
        children in interface javax.swing.tree.TreeNode
      • getAllowsChildren

        public boolean getAllowsChildren()
        Specified by:
        getAllowsChildren in interface javax.swing.tree.TreeNode
        Returns:
        the same value as (currently unused) isDir()
      • getChildAt

        @NotNull
        public @NotNull javax.swing.tree.TreeNode getChildAt​(int childIndex)
        Specified by:
        getChildAt in interface javax.swing.tree.TreeNode
      • getChildCount

        public int getChildCount()
        Specified by:
        getChildCount in interface javax.swing.tree.TreeNode
      • getIndex

        public int getIndex​(@NotNull
                            @NotNull javax.swing.tree.TreeNode node)
        Specified by:
        getIndex in interface javax.swing.tree.TreeNode
      • getParent

        @Nullable
        public @Nullable NamedTreeNode<E> getParent()
        Specified by:
        getParent in interface javax.swing.tree.TreeNode
      • isLeaf

        public boolean isLeaf()
        Specified by:
        isLeaf in interface javax.swing.tree.TreeNode
        Returns:
        true for face nodes, false for directory nodes
      • equals

        public boolean equals​(@Nullable
                              @Nullable java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(@NotNull
                             @NotNull NamedTreeNode<E> o)
        Specified by:
        compareTo in interface java.lang.Comparable<E extends NamedObject>
      • getPathFor

        @NotNull
        public @NotNull javax.swing.tree.TreePath getPathFor​(@NotNull
                                                             @NotNull java.lang.String path)
        Get the path for a node.
        Parameters:
        path - the String specifying the node
        Returns:
        the tree path pointing to initial
      • toString

        @NotNull
        public @NotNull java.lang.String toString()
        Overrides:
        toString in class java.lang.Object