Package net.sf.gridarta.model.data
Class NamedTreeNode<E extends NamedObject>
- java.lang.Object
-
- net.sf.gridarta.model.data.NamedTreeNode<E>
-
- 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 aJTree.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NamedTreeNode()Creates a root node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(@NotNull NamedObject namedObject)Append a node.@NotNull java.util.Enumeration<NamedTreeNode<E>>children()intcompareTo(@NotNull NamedTreeNode<E> o)booleanequals(@Nullable java.lang.Object obj)booleangetAllowsChildren()@NotNull javax.swing.tree.TreeNodegetChildAt(int childIndex)intgetChildCount()intgetIndex(@NotNull javax.swing.tree.TreeNode node)@NotNull java.lang.StringgetName()Returns the name.@Nullable NamedObjectgetNamedObject()Returns the AbstractNamedObject of this node.@Nullable NamedTreeNode<E>getParent()@NotNull javax.swing.tree.TreePathgetPathFor(@NotNull java.lang.String path)Get the path for a node.inthashCode()booleanisLeaf()@NotNull java.lang.StringtoString()
-
-
-
Constructor Detail
-
NamedTreeNode
public NamedTreeNode()
Creates a root node. All other nodes must be created viaappend(NamedObject).
-
-
Method Detail
-
append
public void append(@NotNull @NotNull NamedObject namedObject) throws IllegalNamedObjectExceptionAppend a node.- Parameters:
namedObject- the node to append- Throws:
IllegalNamedObjectException- if the named object cannot be added
-
getNamedObject
@Nullable public @Nullable NamedObject getNamedObject()
Returns the AbstractNamedObject of this node. Only returns an object for leaf nodes. For dir nodes, it returnsnull- Returns:
- the abstract named object of leaf node /
nullfor 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:
childrenin interfacejavax.swing.tree.TreeNode
-
getAllowsChildren
public boolean getAllowsChildren()
- Specified by:
getAllowsChildrenin interfacejavax.swing.tree.TreeNode- Returns:
- the same value as (currently unused)
isDir()
-
getChildAt
@NotNull public @NotNull javax.swing.tree.TreeNode getChildAt(int childIndex)
- Specified by:
getChildAtin interfacejavax.swing.tree.TreeNode
-
getChildCount
public int getChildCount()
- Specified by:
getChildCountin interfacejavax.swing.tree.TreeNode
-
getIndex
public int getIndex(@NotNull @NotNull javax.swing.tree.TreeNode node)- Specified by:
getIndexin interfacejavax.swing.tree.TreeNode
-
getParent
@Nullable public @Nullable NamedTreeNode<E> getParent()
- Specified by:
getParentin interfacejavax.swing.tree.TreeNode
-
isLeaf
public boolean isLeaf()
- Specified by:
isLeafin interfacejavax.swing.tree.TreeNode- Returns:
truefor face nodes,falsefor directory nodes
-
equals
public boolean equals(@Nullable @Nullable java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
compareTo
public int compareTo(@NotNull @NotNull NamedTreeNode<E> o)- Specified by:
compareToin interfacejava.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:
toStringin classjava.lang.Object
-
-