|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectyu.ac.bg.etf.javaqx.qswing.tree.DefaultMutableTreeNode
Default Mutable Tree Node.
Field Summary | |
protected boolean |
allowsChildren
|
protected java.util.ArrayList |
children
|
protected MutableTreeNode |
parent
|
protected java.lang.Object |
userObject
|
Constructor Summary | |
DefaultMutableTreeNode()
Constructs new DefaultMutableTreeNode object. |
|
DefaultMutableTreeNode(java.lang.Object userObject)
Constructs new DefaultMutableTreeNode object. |
|
DefaultMutableTreeNode(java.lang.Object userObject,
boolean allowsChildren)
Constructs new DefaultMutableTreeNode object. |
Method Summary | |
void |
add(MutableTreeNode child)
Adds a new child. |
java.util.Iterator |
children()
Returns iterator over the children of the node. |
java.lang.Object |
clone()
|
boolean |
getAllowsChildren()
Returns true if the node allows children. |
TreeNode |
getChildAt(int index)
Returns child at the specified index. |
int |
getChildCount()
Returns the number of children. |
TreeNode |
getFirstChild()
Returns the first child of this node. |
Icon |
getIcon()
Returns node's icon. |
int |
getIndex(TreeNode node)
Returns index of specified node or -1 if there is no such node. |
TreeNode |
getLastChild()
Returns the last child of this node. |
TreeNode |
getParent()
Returns parent of the node. |
java.lang.Object |
getUserObject()
Returns the user object. |
void |
insert(MutableTreeNode child,
int index)
Inserts specified child at specified index. |
boolean |
isLeaf()
Returns true if the node is leaf. |
boolean |
isNodeAncestor(TreeNode node)
Returns true if the specified node is ancestor of the this node. |
boolean |
isNodeChild(TreeNode node)
Returns true if the specified node is a child of this node. |
void |
remove(int index)
Removes child at the specified index. |
void |
remove(MutableTreeNode node)
Removes specified node. |
void |
removeFromParent()
Removes the node form its parent. |
void |
setParent(MutableTreeNode parent)
Sets the parent of the node. |
void |
setUserObject(java.lang.Object object)
Sets user object. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected MutableTreeNode parent
protected java.util.ArrayList children
protected java.lang.Object userObject
protected boolean allowsChildren
Constructor Detail |
public DefaultMutableTreeNode()
public DefaultMutableTreeNode(java.lang.Object userObject)
userObject
- the user object.public DefaultMutableTreeNode(java.lang.Object userObject, boolean allowsChildren)
userObject
- the user object.allowsChildren
- if true the node allows childrenMethod Detail |
public java.lang.Object getUserObject()
public void add(MutableTreeNode child)
child
- the child node
java.lang.IllegalArgumentException
- if child is null or child is an
ancestor
java.lang.IllegalStateException
- if the node does not allow childrenpublic boolean isNodeAncestor(TreeNode node)
node
- the specified node
public boolean isNodeChild(TreeNode node)
node
- the node
public TreeNode getFirstChild()
java.util.NoSuchElementException
- if the node has no childrenpublic TreeNode getLastChild()
java.util.NoSuchElementException
- if the node has no childrenpublic Icon getIcon()
NOTE: This method is preliminary.
public TreeNode getParent()
getParent
in interface TreeNode
public void setParent(MutableTreeNode parent)
setParent
in interface MutableTreeNode
parent
- the new parentpublic void removeFromParent()
removeFromParent
in interface MutableTreeNode
public boolean isLeaf()
isLeaf
in interface TreeNode
public boolean getAllowsChildren()
getAllowsChildren
in interface TreeNode
public int getChildCount()
getChildCount
in interface TreeNode
public TreeNode getChildAt(int index)
getChildAt
in interface TreeNode
index
- the child index
public int getIndex(TreeNode node)
getIndex
in interface TreeNode
node
- the node
public void insert(MutableTreeNode child, int index)
insert
in interface MutableTreeNode
child
- the childindex
- the indexpublic void remove(int index)
remove
in interface MutableTreeNode
index
- the indexpublic void remove(MutableTreeNode node)
remove
in interface MutableTreeNode
node
- the nodepublic void setUserObject(java.lang.Object object)
setUserObject
in interface MutableTreeNode
object
- the objectpublic java.util.Iterator children()
children
in interface TreeNode
public java.lang.Object clone()
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |