|
|||||||||
| Home >> All >> com >> lanceolav >> [ jreftree overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.lanceolav.jreftree
Class W3CMutableTreeNode

java.lang.Objectcom.lanceolav.jreftree.W3CMutableTreeNode
- All Implemented Interfaces:
- javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
- public class W3CMutableTreeNode
- extends java.lang.Object
- implements javax.swing.tree.MutableTreeNode
- extends java.lang.Object
W3CMutableTreeNode can be used in DefaultTreeModel (in addition to DefaultMutableTreeNode). It is only a thin wrapper around org.w3c.dom.Node, and owns only one instane of this class. It let's this node take care of all the bookkeeping with parents and children. The advantage is that we don't have to implement TreeModel, but can use the existing DefaultTreeModel, which has methods such as insertNodeInto(), which will dispatch the necessary events to update the tree.
| Field Summary | |
private org.w3c.dom.Node |
domNode
|
private static java.lang.String[] |
typeName
|
| Constructor Summary | |
W3CMutableTreeNode(org.w3c.dom.Node node)
|
|
| Method Summary | |
java.util.Enumeration |
children()
Returns the children of the receiver as an Enumeration. |
boolean |
getAllowsChildren()
Returns true if the receiver allows children. |
javax.swing.tree.TreeNode |
getChildAt(int childIndex)
Returns the child TreeNode at index
childIndex. |
int |
getChildCount()
Returns the number of children TreeNodes the receiver
contains. |
int |
getIndex(javax.swing.tree.TreeNode node)
Returns the index of node in the receivers children. |
private org.w3c.dom.Node |
getNode(javax.swing.tree.MutableTreeNode mtn)
|
private org.w3c.dom.Node |
getNode(javax.swing.tree.TreeNode tn)
|
javax.swing.tree.TreeNode |
getParent()
Returns the parent TreeNode of the receiver. |
void |
insert(javax.swing.tree.MutableTreeNode child,
int index)
Adds child to the receiver at index. |
boolean |
isLeaf()
Returns true if the receiver is a leaf. |
void |
remove(int index)
Removes the child at index from the receiver. |
void |
remove(javax.swing.tree.MutableTreeNode node)
Removes node from the receiver. |
void |
removeFromParent()
Removes the receiver from its parent. |
void |
setParent(javax.swing.tree.MutableTreeNode newParent)
Sets the parent of the receiver to newParent. |
void |
setUserObject(java.lang.Object object)
Resets the user object of the receiver to object. |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
domNode
private org.w3c.dom.Node domNode
typeName
private static final java.lang.String[] typeName
| Constructor Detail |
W3CMutableTreeNode
public W3CMutableTreeNode(org.w3c.dom.Node node)
| Method Detail |
getNode
private org.w3c.dom.Node getNode(javax.swing.tree.MutableTreeNode mtn)
getNode
private org.w3c.dom.Node getNode(javax.swing.tree.TreeNode tn)
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
insert
public void insert(javax.swing.tree.MutableTreeNode child, int index)
- Adds
childto the receiver atindex.childwill be messaged withsetParent.- Specified by:
insertin interfacejavax.swing.tree.MutableTreeNode
remove
public void remove(int index)
- Removes the child at
indexfrom the receiver.- Specified by:
removein interfacejavax.swing.tree.MutableTreeNode
remove
public void remove(javax.swing.tree.MutableTreeNode node)
- Removes
nodefrom the receiver.setParentwill be messaged onnode.- Specified by:
removein interfacejavax.swing.tree.MutableTreeNode
setUserObject
public void setUserObject(java.lang.Object object)
- Resets the user object of the receiver to
object.- Specified by:
setUserObjectin interfacejavax.swing.tree.MutableTreeNode
removeFromParent
public void removeFromParent()
- Removes the receiver from its parent.
- Specified by:
removeFromParentin interfacejavax.swing.tree.MutableTreeNode
setParent
public void setParent(javax.swing.tree.MutableTreeNode newParent)
- Sets the parent of the receiver to
newParent.- Specified by:
setParentin interfacejavax.swing.tree.MutableTreeNode
getChildAt
public javax.swing.tree.TreeNode getChildAt(int childIndex)
- Returns the child
TreeNodeat indexchildIndex.- Specified by:
getChildAtin interfacejavax.swing.tree.TreeNode
getChildCount
public int getChildCount()
- Returns the number of children
TreeNodes the receiver contains.- Specified by:
getChildCountin interfacejavax.swing.tree.TreeNode
getParent
public javax.swing.tree.TreeNode getParent()
- Returns the parent
TreeNodeof the receiver.- Specified by:
getParentin interfacejavax.swing.tree.TreeNode
getIndex
public int getIndex(javax.swing.tree.TreeNode node)
- Returns the index of
nodein the receivers children. If the receiver does not containnode, -1 will be returned.- Specified by:
getIndexin interfacejavax.swing.tree.TreeNode
getAllowsChildren
public boolean getAllowsChildren()
- Returns true if the receiver allows children.
- Specified by:
getAllowsChildrenin interfacejavax.swing.tree.TreeNode
isLeaf
public boolean isLeaf()
- Returns true if the receiver is a leaf.
- Specified by:
isLeafin interfacejavax.swing.tree.TreeNode
children
public java.util.Enumeration children()
- Returns the children of the receiver as an
Enumeration.- Specified by:
childrenin interfacejavax.swing.tree.TreeNode
|
|||||||||
| Home >> All >> com >> lanceolav >> [ jreftree overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.lanceolav.jreftree.W3CMutableTreeNode