com.imagero.gui.swing.tree.node
Class DummyNode

java.lang.Object
  extended byjavax.swing.tree.DefaultMutableTreeNode
      extended bycom.imagero.gui.swing.tree.node.DMTreeNode
          extended bycom.imagero.gui.swing.tree.node.HTreeNode
              extended bycom.imagero.gui.swing.tree.node.DummyNode
All Implemented Interfaces:
java.lang.Cloneable, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode

public class DummyNode
extends HTreeNode

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.imagero.gui.swing.tree.node.HTreeNode
stringComparator
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, EMPTY_ENUMERATION, userObject
 
Constructor Summary
DummyNode(java.lang.Object userObject)
           
 
Method Summary
 java.util.Enumeration children()
          Creates and returns a forward-order enumeration of this node's children.
 boolean getAllowsChildren()
          Returns true if this node is allowed to have children.
 javax.swing.tree.TreeNode getChildAt(int childIndex)
          Returns the child at the specified index in this node's child array.
 int getChildCount()
          Returns the number of children of this node.
 int getIndex(javax.swing.tree.TreeNode node)
          Returns the index of the specified child in this node's child array.
 javax.swing.tree.TreeNode getParent()
          Returns this node's parent or null if this node has no parent.
 void insert(javax.swing.tree.MutableTreeNode child, int index)
          Removes newChild from its present parent (if it has a parent), sets the child's parent to this node, and then adds the child to this node's child array at index childIndex.
 boolean isLeaf()
          Returns true if this node has no children.
 void remove(int index)
          Removes the child at the specified index from this node's children and sets that node's parent to null.
 void remove(javax.swing.tree.MutableTreeNode node)
          Removes aChild from this node's child array, giving it a null parent.
 void removeFromParent()
          Removes the subtree rooted at this node from the tree, giving this node a null parent.
 void setParent(javax.swing.tree.MutableTreeNode newParent)
          Sets this node's parent to newParent but does not change the parent's child array.
 void setUserObject(java.lang.Object object)
          Sets the user object for this node to userObject.
 
Methods inherited from class com.imagero.gui.swing.tree.node.HTreeNode
getHandler, isPopulated, populate, repopulate, setHandler, setPopulated, sort, toString
 
Methods inherited from class com.imagero.gui.swing.tree.node.DMTreeNode
add, add, childIndex, createNode, sort
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, clone, depthFirstEnumeration, getChildAfter, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, removeAllChildren, setAllowsChildren
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DummyNode

public DummyNode(java.lang.Object userObject)
Method Detail

children

public java.util.Enumeration children()
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Creates and returns a forward-order enumeration of this node's children. Modifying this node's child array invalidates any child enumerations created before the modification.

Returns:
an Enumeration of this node's children

getAllowsChildren

public boolean getAllowsChildren()
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Returns true if this node is allowed to have children.

Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode
Overrides:
getAllowsChildren in class HTreeNode

getChildAt

public javax.swing.tree.TreeNode getChildAt(int childIndex)
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Returns the child at the specified index in this node's child array.

Parameters:
childIndex - an index into this node's child array
Returns:
the TreeNode in this node's child array at the specified index

getChildCount

public int getChildCount()
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Returns the number of children of this node.

Returns:
an int giving the number of children of this node

getIndex

public int getIndex(javax.swing.tree.TreeNode node)
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Returns the index of the specified child in this node's child array. If the specified node is not a child of this node, returns -1. This method performs a linear search and is O(n) where n is the number of children.

Parameters:
node - the TreeNode to search for among this node's children
Returns:
an int giving the index of the node in this node's child array, or -1 if the specified node is a not a child of this node

getParent

public javax.swing.tree.TreeNode getParent()
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Returns this node's parent or null if this node has no parent.

Returns:
this node's parent TreeNode, or null if this node has no parent

insert

public void insert(javax.swing.tree.MutableTreeNode child,
                   int index)
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Removes newChild from its present parent (if it has a parent), sets the child's parent to this node, and then adds the child to this node's child array at index childIndex. newChild must not be null and must not be an ancestor of this node.

Parameters:
child - the MutableTreeNode to insert under this node
index - the index in this node's child array where this node is to be inserted
See Also:
DefaultMutableTreeNode.isNodeDescendant(javax.swing.tree.DefaultMutableTreeNode)

isLeaf

public boolean isLeaf()
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Returns true if this node has no children. To distinguish between nodes that have no children and nodes that cannot have children (e.g. to distinguish files from empty directories), use this method in conjunction with getAllowsChildren

Specified by:
isLeaf in interface javax.swing.tree.TreeNode
Overrides:
isLeaf in class HTreeNode

remove

public void remove(int index)
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Removes the child at the specified index from this node's children and sets that node's parent to null. The child node to remove must be a MutableTreeNode.

Parameters:
index - the index in this node's child array of the child to remove

remove

public void remove(javax.swing.tree.MutableTreeNode node)
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Removes aChild from this node's child array, giving it a null parent.

Parameters:
node - a child of this node to remove

removeFromParent

public void removeFromParent()
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Removes the subtree rooted at this node from the tree, giving this node a null parent. Does nothing if this node is the root of its tree.


setParent

public void setParent(javax.swing.tree.MutableTreeNode newParent)
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Sets this node's parent to newParent but does not change the parent's child array. This method is called from insert() and remove() to reassign a child's parent, it should not be messaged from anywhere else.

Parameters:
newParent - this node's new parent

setUserObject

public void setUserObject(java.lang.Object object)
Description copied from class: javax.swing.tree.DefaultMutableTreeNode
Sets the user object for this node to userObject.

Parameters:
object - the Object that constitutes this node's user-specified data
See Also:
DefaultMutableTreeNode.getUserObject(), DefaultMutableTreeNode.toString()