.useful Home Page

org.dotuseful.ui.tree
Class AutomatedTreeModel

java.lang.Object
  extended byjavax.swing.tree.DefaultTreeModel
      extended byorg.dotuseful.ui.tree.AutomatedTreeModel
All Implemented Interfaces:
java.util.EventListener, java.io.Serializable, javax.swing.tree.TreeModel, javax.swing.event.TreeModelListener

public class AutomatedTreeModel
extends javax.swing.tree.DefaultTreeModel
implements javax.swing.event.TreeModelListener

AutomatedTreeModel extends DefaultTreeModel and uses AutomatedTreeNodes as its nodes.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultTreeModel
asksAllowsChildren, listenerList, root
 
Constructor Summary
AutomatedTreeModel(AutomatedTreeNode root)
          Creates an AutomatedTreeModel in which any node can have children.
AutomatedTreeModel(AutomatedTreeNode root, boolean asksAllowsChildren)
          Creates an AutomatedTreeModel specifying whether any node can have children, or whether only certain nodes can have children.
 
Method Summary
 void setRoot(javax.swing.tree.TreeNode root)
          Sets the root to root.
 void treeNodesChanged(javax.swing.event.TreeModelEvent e)
           Invoked after a node (or a set of siblings) has changed in some way.
 void treeNodesInserted(javax.swing.event.TreeModelEvent e)
           Invoked after nodes have been inserted into the tree.
 void treeNodesRemoved(javax.swing.event.TreeModelEvent e)
           Invoked after nodes have been removed from the tree.
 void treeStructureChanged(javax.swing.event.TreeModelEvent e)
           Invoked after the tree has drastically changed structure from a given node down.
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutomatedTreeModel

public AutomatedTreeModel(AutomatedTreeNode root)
Creates an AutomatedTreeModel in which any node can have children.

Parameters:
root - an AutomatedTreeNode object that is the root of the tree
See Also:
AutomatedTreeModel(AutomatedTreeNode, boolean)

AutomatedTreeModel

public AutomatedTreeModel(AutomatedTreeNode root,
                          boolean asksAllowsChildren)
Creates an AutomatedTreeModel specifying whether any node can have children, or whether only certain nodes can have children.

Parameters:
root - an AutomatedTreeNode object that is the root of the tree
asksAllowsChildren - a boolean, false if any node can have children, true if each node is asked to see if it can have children
See Also:
DefaultTreeModel.asksAllowsChildren
Method Detail

setRoot

public void setRoot(javax.swing.tree.TreeNode root)
Sets the root to root. A null root implies the tree is to display nothing, and is legal.


treeNodesChanged

public void treeNodesChanged(javax.swing.event.TreeModelEvent e)

Invoked after a node (or a set of siblings) has changed in some way. The node(s) have not changed locations in the tree or altered their children arrays, but other attributes have changed and may affect presentation. Example: the name of a file has changed, but it is in the same location in the file system.

Specified by:
treeNodesChanged in interface javax.swing.event.TreeModelListener

treeNodesInserted

public void treeNodesInserted(javax.swing.event.TreeModelEvent e)

Invoked after nodes have been inserted into the tree.

Specified by:
treeNodesInserted in interface javax.swing.event.TreeModelListener

treeNodesRemoved

public void treeNodesRemoved(javax.swing.event.TreeModelEvent e)

Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree, this method may only be invoked once for the root of the removed subtree, not once for each individual set of siblings removed.

Specified by:
treeNodesRemoved in interface javax.swing.event.TreeModelListener

treeStructureChanged

public void treeStructureChanged(javax.swing.event.TreeModelEvent e)

Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.

Specified by:
treeStructureChanged in interface javax.swing.event.TreeModelListener

© 2004 .useful community

SourceForge.net-Logo