com.metamatrix.toolbox.ui.widget.tree
Class DefaultTreeNode

java.lang.Object
  extended by com.metamatrix.toolbox.ui.widget.tree.DefaultTreeNode
All Implemented Interfaces:
PropertiedObject, TreeNode, java.lang.Cloneable, java.lang.Comparable
Direct Known Subclasses:
SortableChildrenNode

public class DefaultTreeNode
extends java.lang.Object
implements java.lang.Cloneable, TreeNode

This is the default TreeNode used by DefaultTreeModel.

Since:
2.0
Version:
2.0
Author:
John P. A. Verhaeg

Constructor Summary
DefaultTreeNode()
          Creates a nameless root DefaultTreeNode.
DefaultTreeNode(DefaultTreeNode parent)
           
DefaultTreeNode(java.lang.Object content)
           
DefaultTreeNode(java.lang.Object content, DefaultTreeNode parent)
           
DefaultTreeNode(java.lang.String name)
           
DefaultTreeNode(java.lang.String name, DefaultTreeNode parent)
           
DefaultTreeNode(java.lang.String name, DefaultTreeNode parent, java.lang.Object content)
           
DefaultTreeNode(java.lang.String name, java.lang.Object content)
           
 
Method Summary
 int addChild(java.lang.Object child)
           
 boolean addChild(java.lang.Object child, int index)
           
 int addChildren(java.util.Collection children)
           
 int addChildren(java.lang.Object[] children)
           
 java.lang.Object clone()
           
 int compareTo(java.lang.Object node)
          Compares this object to another.
 boolean contains(DefaultTreeNode child)
           
protected  void createChildList()
           
 boolean equals(java.lang.Object node)
          Returns true if the specified object is semantically equal to this instance.
 boolean exists()
          Not implemented.
 DefaultTreeNode getChild(int index)
           
 int getChildCount()
           
 int getChildIndex(DefaultTreeNode child)
           
 java.util.List getChildren()
           
 java.lang.Object getContent()
           
 java.lang.String getFullName()
          Convenience method for Object.toString().
 java.util.Iterator getIterator()
           
 java.util.ListIterator getListIterator()
           
 java.lang.String getName()
          Convenience method for Object.toString().
 java.lang.String getNamespace()
          Not implemented.
 DefaultTreeNode getParent()
           
 DefaultTreeNode getRoot()
           
 java.util.List getRoots()
           
 java.lang.String getSeparator()
          Not implemented.
 char getSeparatorChar()
          Not implemented.
 ObjectDefinition getType()
          Not implemented.
protected  void initializeDefaultTreeNode()
           
 boolean isDescendentOf(DefaultTreeNode ancestor)
           
 boolean isEmpty()
           
 boolean isModified()
          Return whether this node has undergone changes.
 boolean isRoot()
           
 int removeAllChildren()
           
 int removeChild(DefaultTreeNode child)
           
 DefaultTreeNode removeChild(int index)
           
 void setContent(java.lang.Object content)
          Sets the object contained within this node.
 void setName(java.lang.String name)
          Sets the name of this node.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.metamatrix.common.tree.TreeNode
toString
 

Constructor Detail

DefaultTreeNode

public DefaultTreeNode()
Creates a nameless root DefaultTreeNode.

Since:
2.0

DefaultTreeNode

public DefaultTreeNode(java.lang.String name)
Since:
2.0

DefaultTreeNode

public DefaultTreeNode(DefaultTreeNode parent)
Since:
2.0

DefaultTreeNode

public DefaultTreeNode(java.lang.Object content)
Since:
2.0

DefaultTreeNode

public DefaultTreeNode(java.lang.String name,
                       DefaultTreeNode parent)
Since:
2.0

DefaultTreeNode

public DefaultTreeNode(java.lang.String name,
                       java.lang.Object content)
Since:
2.0

DefaultTreeNode

public DefaultTreeNode(java.lang.Object content,
                       DefaultTreeNode parent)
Since:
2.0

DefaultTreeNode

public DefaultTreeNode(java.lang.String name,
                       DefaultTreeNode parent,
                       java.lang.Object content)
Since:
2.0
Method Detail

addChild

public int addChild(java.lang.Object child)
Since:
2.0

addChild

public boolean addChild(java.lang.Object child,
                        int index)
Since:
2.0

addChildren

public int addChildren(java.lang.Object[] children)
Since:
2.0

addChildren

public int addChildren(java.util.Collection children)
Since:
2.0

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException - Never thrown
Since:
2.0

compareTo

public int compareTo(java.lang.Object node)
Description copied from interface: TreeNode
Compares this object to another. If the specified object is an instance of the TreeNode class, then this method compares the contents; otherwise, it throws a ClassCastException (as instances are comparable only to instances of the same class).

Note: this method is consistent with equals(), meaning that (compare(x, y)==0) == (x.equals(y)).

Specified by:
compareTo in interface TreeNode
Specified by:
compareTo in interface java.lang.Comparable
Returns:
A negative number, zero, or a positive number depending on whether this node's name is alphabetically less than, equal to, or greater then the specified node's name, respectively
Since:
2.0

contains

public boolean contains(DefaultTreeNode child)
Since:
2.0

createChildList

protected void createChildList()
Since:
2.0

equals

public boolean equals(java.lang.Object node)
Description copied from interface: TreeNode
Returns true if the specified object is semantically equal to this instance. Note: this method is consistent with compareTo().

Specified by:
equals in interface TreeNode
Overrides:
equals in class java.lang.Object
Returns:
True if this node's name is alphabetically equal to the specified node's name
Since:
2.0

exists

public boolean exists()
Not implemented.

Specified by:
exists in interface TreeNode
Returns:
true the entry exists, or false otherwise.

getChild

public DefaultTreeNode getChild(int index)
Since:
2.0

getChildCount

public int getChildCount()
Since:
2.0

getChildIndex

public int getChildIndex(DefaultTreeNode child)
Since:
2.0

getChildren

public java.util.List getChildren()
Since:
2.0

getContent

public java.lang.Object getContent()
Returns:
The object contained within this node.
Since:
2.0

getFullName

public java.lang.String getFullName()
Convenience method for Object.toString(). Exists only to satisfy interface requirement.

Specified by:
getFullName in interface TreeNode
Returns:
The name of the node
Since:
2.0

getIterator

public java.util.Iterator getIterator()
Since:
2.0

getListIterator

public java.util.ListIterator getListIterator()
Since:
2.0

getName

public java.lang.String getName()
Convenience method for Object.toString().

Specified by:
getName in interface TreeNode
Returns:
the name of the node; never null or zero-length
Since:
2.0

getNamespace

public java.lang.String getNamespace()
Not implemented.

Specified by:
getNamespace in interface TreeNode
Returns:
the string that represents the namespace of this node; never null
Since:
2.0

getParent

public DefaultTreeNode getParent()
Since:
2.0

getRoot

public DefaultTreeNode getRoot()
Since:
2.0

getRoots

public java.util.List getRoots()
Since:
2.0

getSeparator

public java.lang.String getSeparator()
Not implemented.

Specified by:
getSeparator in interface TreeNode
Returns:
the string containing the charater used to delimit names in the abstract path; never null
Since:
2.0

getSeparatorChar

public char getSeparatorChar()
Not implemented.

Specified by:
getSeparatorChar in interface TreeNode
Returns:
the charater used to delimit names in the abstract path.
Since:
2.0

getType

public ObjectDefinition getType()
Not implemented.

Specified by:
getType in interface TreeNode
Returns:
the entity's type; never null
Since:
2.0

initializeDefaultTreeNode

protected void initializeDefaultTreeNode()
Since:
2.0

isDescendentOf

public boolean isDescendentOf(DefaultTreeNode ancestor)
Since:
2.0

isEmpty

public boolean isEmpty()
Since:
2.0

isModified

public boolean isModified()
Description copied from interface: TreeNode
Return whether this node has undergone changes. The time from which changes are maintained is left to the implementation.

Specified by:
isModified in interface TreeNode
Returns:
true if this TreeNode has changes, or false otherwise.
Since:
2.0

isRoot

public boolean isRoot()
Since:
2.0

removeAllChildren

public int removeAllChildren()
Since:
2.0

removeChild

public int removeChild(DefaultTreeNode child)
Since:
2.0

removeChild

public DefaultTreeNode removeChild(int index)
Since:
2.0

setContent

public void setContent(java.lang.Object content)
Sets the object contained within this node.

Parameters:
content - The object contained within this node
Since:
2.0

setName

public void setName(java.lang.String name)
Sets the name of this node.

Parameters:
name - The name of the node
Since:
2.0


Copyright © 2009. All Rights Reserved.