GNU Classpath (0.20) | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.swing.tree.DefaultMutableTreeNode
public class DefaultMutableTreeNode
extends Object
implements Cloneable, MutableTreeNode, Serializable
Field Summary | |
static Enumeration |
|
protected boolean |
|
protected Vector |
|
protected MutableTreeNode |
|
protected Object |
|
Constructor Summary | |
| |
| |
|
Method Summary | |
void |
|
Enumeration |
|
Enumeration |
|
Object |
|
Enumeration |
|
boolean |
|
TreeNode |
|
TreeNode |
|
TreeNode |
|
int |
|
int |
|
TreeNode |
|
DefaultMutableTreeNode |
|
int | |
TreeNode |
|
DefaultMutableTreeNode |
|
int |
|
int |
|
DefaultMutableTreeNode |
|
DefaultMutableTreeNode |
|
DefaultMutableTreeNode |
|
TreeNode |
|
TreeNode[] |
|
protected TreeNode[] |
|
DefaultMutableTreeNode |
|
DefaultMutableTreeNode |
|
DefaultMutableTreeNode |
|
TreeNode |
|
TreeNode |
|
int |
|
Object |
|
Object[] |
|
void |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
Enumeration |
|
Enumeration |
|
Enumeration |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
String |
|
Methods inherited from class java.lang.Object | |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
public DefaultMutableTreeNode()
Creates aDefaultMutableTreeNode
object. This node allows to add child nodes.
public DefaultMutableTreeNode(Object userObject)
Creates aDefaultMutableTreeNode
object with the given user object attached to it. This node allows to add child nodes.
- Parameters:
userObject
- the user object
public DefaultMutableTreeNode(Object userObject, boolean allowsChildren)
Creates aDefaultMutableTreeNode
object with the given user object attached to it.
- Parameters:
userObject
- the user objectallowsChildren
-true
if the code allows to add child nodes,false
otherwise
public void add(MutableTreeNode child)
Adds a new child node to this node.
- Parameters:
child
- the child node
- Throws:
IllegalArgumentException
- ifchild
is nullIllegalStateException
- if the node does not allow children
public Enumeration breadthFirstEnumeration()
breadthFirstEnumeration
- Returns:
- Enumeration
public Enumeration children()
Returns an enumeration containing all children of this node.EMPTY_ENUMERATION
is returned if this node has no children.
- Returns:
- an enumeration of tree nodes
public Enumeration depthFirstEnumeration()
depthFirstEnumeration
- Returns:
- Enumeration
public boolean getAllowsChildren()
getAllowsChildren
- Specified by:
- getAllowsChildren in interface TreeNode
- Returns:
- boolean
public TreeNode getChildAfter(TreeNode node)
getChildAfter
- Parameters:
node
- TODO
- Returns:
- TreeNode
public TreeNode getChildAt(int index)
Returns the child node at a given index.
- Specified by:
- getChildAt in interface TreeNode
- Parameters:
index
- the index
- Returns:
- the child node
public TreeNode getChildBefore(TreeNode node)
getChildBefore
- Parameters:
node
- TODO
- Returns:
- TreeNode
public int getChildCount()
Returns the number of children of this node.
- Specified by:
- getChildCount in interface TreeNode
- Returns:
- the number of children
public DefaultMutableTreeNode getFirstLeaf()
getFirstLeaf
- Returns:
- DefaultMutableTreeNode
public int getIndex(TreeNode node)
Returns the child index for a given node.
- Parameters:
node
- this node
- Returns:
- the index
public DefaultMutableTreeNode getNextSibling()
getNextSibling
- Returns:
- DefaultMutableTreeNode
public TreeNode[] getPath()
Returns a path to this node from the root.
- Returns:
- an array of tree nodes
protected TreeNode[] getPathToRoot(TreeNode node, int depth)
getPathToRoot
- Parameters:
node
- TODOdepth
- TODO
- Returns:
- TreeNode[]
public DefaultMutableTreeNode getPreviousLeaf()
getPreviousLeaf
- Returns:
- DefaultMutableTreeNode
public DefaultMutableTreeNode getPreviousNode()
getPreviousNode
- Returns:
- DefaultMutableTreeNode
public DefaultMutableTreeNode getPreviousSibling()
getPreviousSibling
- Returns:
- DefaultMutableTreeNode
public TreeNode getRoot()
Returns the root node by iterating the parents of this node.
- Returns:
- the root node
public TreeNode getSharedAncestor(DefaultMutableTreeNode node)
getSharedAncestor
- Parameters:
node
- TODO
- Returns:
- TreeNode
public Object getUserObject()
Returns the user object attached to this node.null
is returned when no user object is set.
- Returns:
- the user object
public void insert(MutableTreeNode node, int index)
Inserts given child node at the given index.
- Specified by:
- insert in interface MutableTreeNode
- Parameters:
node
- the child nodeindex
- the index.
public boolean isNodeAncestor(TreeNode node)
isNodeAncestor
- Parameters:
node
- TODO
- Returns:
- boolean
public boolean isNodeChild(TreeNode node)
isNodeChild
- Parameters:
node
- TODO
- Returns:
- boolean
public boolean isNodeDescendant(DefaultMutableTreeNode node)
isNodeDescendant
- Parameters:
node
- TODO
- Returns:
- boolean
public boolean isNodeRelated(DefaultMutableTreeNode node)
isNodeRelated
- Parameters:
node
- TODO
- Returns:
- boolean
public boolean isNodeSibling(TreeNode node)
isNodeSibling
- Parameters:
node
- TODO
- Returns:
- boolean
public boolean isRoot()
Tells whether this node is the root node or not.
- Returns:
true
if this is the root node,false
otherwise
public Enumeration pathFromAncestorEnumeration(TreeNode node)
pathFromAncestorEnumeration
- Parameters:
node
- TODO
- Returns:
- Enumeration
public Enumeration postorderEnumeration()
postorderEnumeration
- Returns:
- Enumeration
public void remove(int index)
Removes the child with the given index from this node
- Specified by:
- remove in interface MutableTreeNode
- Parameters:
index
- the index
public void remove(MutableTreeNode node)
Removes the given child from this node.
- Specified by:
- remove in interface MutableTreeNode
- Parameters:
node
- the child node
public void removeFromParent()
Removes this node from its parent.
- Specified by:
- removeFromParent in interface MutableTreeNode
public void setAllowsChildren(boolean allowsChildren)
setAllowsChildren
- Parameters:
allowsChildren
- TODO
public void setParent(MutableTreeNode node)
Set the parent node for this node.
- Specified by:
- setParent in interface MutableTreeNode
- Parameters:
node
- the parent node
public void setUserObject(Object userObject)
Sets the user object for this node
- Specified by:
- setUserObject in interface MutableTreeNode
- Parameters:
userObject
- the user object
GNU Classpath (0.20) |