org.argouml.ui
Class TreeModelComposite

java.lang.Object
  |
  +--org.argouml.ui.PerspectiveSupport
        |
        +--org.argouml.ui.TreeModelSupport
              |
              +--org.argouml.ui.TreeModelComposite
All Implemented Interfaces:
javax.swing.tree.TreeModel
Direct Known Subclasses:
NavPerspective, ToDoPerspective

public class TreeModelComposite
extends TreeModelSupport
implements javax.swing.tree.TreeModel

This class is the TreeModel for the navigator and todo list panels.

It is called Composite because there are a set of rules that determine how to link parents to children in the tree. Those rules can now be found in PerspectiveSupport.

$Id: TreeModelComposite.java,v 1.16 2003/06/29 23:47:02 linus Exp $


Field Summary
protected  java.lang.Object _root
          root of the model
 
Fields inherited from class org.argouml.ui.TreeModelSupport
_listenerList
 
Fields inherited from class org.argouml.ui.PerspectiveSupport
_goRules, _name, _rules
 
Constructor Summary
TreeModelComposite(java.lang.String name)
          needs documenting
 
Method Summary
 java.lang.Object getChild(java.lang.Object parent, int index)
          Finds the each of the children of a parent in the tree.
 int getChildCount(java.lang.Object parent)
          needs documenting
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
          needs documenting
 java.lang.Object getRoot()
          needs documenting
 boolean isLeaf(java.lang.Object node)
          Returns true if node is a leaf.
 void setRoot(java.lang.Object r)
          needs documenting
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
          Empty implementation - not used.
 
Methods inherited from class org.argouml.ui.TreeModelSupport
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, fireTreeStructureChanged, fireTreeStructureChanged, fireTreeStructureChanged, fireTreeStructureChanged, removeTreeModelListener
 
Methods inherited from class org.argouml.ui.PerspectiveSupport
addSubTreeModel, getName, getRegisteredRules, getSubTreeModels, registerRule, removeSubTreeModel, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, removeTreeModelListener
 

Field Detail

_root

protected java.lang.Object _root
root of the model

Constructor Detail

TreeModelComposite

public TreeModelComposite(java.lang.String name)
needs documenting

Method Detail

getRoot

public java.lang.Object getRoot()
needs documenting

Specified by:
getRoot in interface javax.swing.tree.TreeModel

getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)
Finds the each of the children of a parent in the tree.

Specified by:
getChild in interface javax.swing.tree.TreeModel
Parameters:
parent - in the tree
index - of child to find
Returns:
the child found at index. Null if index is out of bounds.

getChildCount

public int getChildCount(java.lang.Object parent)
needs documenting

Specified by:
getChildCount in interface javax.swing.tree.TreeModel

getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)
needs documenting

Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel

isLeaf

public boolean isLeaf(java.lang.Object node)
Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.

If none of the subTreeModels is not a leaf, then we are not a leaf.

Specified by:
isLeaf in interface javax.swing.tree.TreeModel
Parameters:
node - a node in the tree, obtained from this data source
Returns:
true if node is a leaf

valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object newValue)
Empty implementation - not used.

Messaged when the user has altered the value for the item identified by path to newValue. If newValue signifies a truly new value the model should post a treeNodesChanged event.

Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel
Parameters:
path - path to the node that the user has altered.
newValue - the new value from the TreeCellEditor.

setRoot

public void setRoot(java.lang.Object r)
needs documenting



ArgoUML © 1996-2003 (20040229)ArgoUML Project HomeArgoUML Cookbook