Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.awt.swing.JTree.DynamicUtilTreeNode

java.lang.Object
    |
    +----java.awt.swing.tree.DefaultMutableTreeNode
            |
            +----java.awt.swing.JTree.DynamicUtilTreeNode

public static class JTree.DynamicUtilTreeNode
extends DefaultMutableTreeNode
DynamicUtilTreeNode can wrap vectors/hashtables/arrays/strings and create the appropriate children tree nodes as necessary. It is dynamic in that it'll only create the children as necessary.

Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.


Field Summary
Object  childValue
Value to create children with.
boolean  hasChildren
 
boolean  loadedChildren
 
 
Fields inherited from class java.awt.swing.tree.DefaultMutableTreeNode
 allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 

Constructor Summary
 JTree.DynamicUtilTreeNode(Object value, Object children)
Creates a node with the specified object as its value and with the specified children.
 

Method Summary
static void  createChildren(DefaultMutableTreeNode parent, Object children)
Adds to parent all the children in children.
int  getChildCount()
Returns the number of child nodes.
boolean  isLeaf()
Returns true if this node allows children.
void  loadChildren()
Loads the children based on childValue.
 
Methods inherited from class java.awt.swing.tree.DefaultMutableTreeNode
 add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hasChildren

protected boolean hasChildren

childValue

protected Object childValue
Value to create children with.

loadedChildren

protected boolean loadedChildren
Constructor Detail

JTree.DynamicUtilTreeNode

public JTree.DynamicUtilTreeNode(Object value,
                                 Object children)
Creates a node with the specified object as its value and with the specified children. For the node to allow children, the children-object must be an array of objects, a Vector, or a Hashtable -- even if empty. Otherwise, the node is not allowed to have children.
Parameters:
value - the Object that is the value for the new node
children - an array of Objects, a Vector, or a Hashtable used to create the child nodes. If any other object is specified, or if the value is null, then the node is not allowed to have children.
Method Detail

createChildren

public static void createChildren(DefaultMutableTreeNode parent,
                                  Object children)
Adds to parent all the children in children. If children is an array or Vector all of its elements are added is children, otherwise if children is a Hashtable all the key/value pairs are added in the order Enumeration returns them.

isLeaf

public boolean isLeaf()
Returns true if this node allows children. Whether the node allows children depends on how it was created.
Returns:
true if this node allows children, false otherwise.
Overrides:
isLeaf in class DefaultMutableTreeNode
See Also:
#DynamicUtilTreeNode(Object, Object)

getChildCount

public int getChildCount()
Returns the number of child nodes.
Returns:
the number of child nodes
Overrides:
getChildCount in class DefaultMutableTreeNode

loadChildren

protected void loadChildren()
Loads the children based on childValue. If childValue is a Vector orarray each element added as a child, if childValue is a Hashtable each key/value pair is added in the order that Enumeration returns the keys.

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.