org.argouml.ui
Class TreeModelSupport

java.lang.Object
  extended by org.argouml.ui.PerspectiveSupport
      extended by org.argouml.ui.TreeModelSupport
Direct Known Subclasses:
TreeModelComposite

public class TreeModelSupport
extends PerspectiveSupport

Helper class for tree models that provides tree event handling.

Since:
0.13.5, Created on 15 April 2003

Constructor Summary
TreeModelSupport(java.lang.String name)
          The constructor.
 
Method Summary
 void addTreeModelListener(javax.swing.event.TreeModelListener l)
          Add a TreeModelListener to the list of listeners.
protected  void fireTreeNodesChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
          Notify all listeners that a node (or a set of siblings) has changed in some way.
protected  void fireTreeNodesInserted(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
          Notify all listeners a node has been inserted.
protected  void fireTreeNodesRemoved(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
          Notify all listeners that nodes have been removed from the tree.
protected  void fireTreeStructureChanged(java.lang.Object[] path)
          Notify all listeners that the tree has drastically changed structure from a given node down.
protected  void fireTreeStructureChanged(java.lang.Object source, java.lang.Object[] path)
          Notify all listeners that the tree has drastically changed structure from a given node down.
 void fireTreeStructureChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
          Notify all listeners that the tree has drastically changed structure from a given node down.
 void removeTreeModelListener(javax.swing.event.TreeModelListener l)
          Remove a TreeModelListener from the list of listeners..
 
Methods inherited from class org.argouml.ui.PerspectiveSupport
addSubTreeModel, getGoRuleList, getGoRules, getName, getSubTreeModelList, getSubTreeModels, registerRule, removeSubTreeModel, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeModelSupport

public TreeModelSupport(java.lang.String name)
The constructor.

Parameters:
name - the name that will be localized
Method Detail

addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener l)
Add a TreeModelListener to the list of listeners.

Parameters:
l - the listener to be added

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
Remove a TreeModelListener from the list of listeners..

Parameters:
l - the listener to be removed

fireTreeNodesChanged

protected void fireTreeNodesChanged(java.lang.Object source,
                                    java.lang.Object[] path,
                                    int[] childIndices,
                                    java.lang.Object[] children)
Notify all listeners that 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.

To indicate the root has changed, childIndices and children will be null.

NOTE: This is a Swing method which must be invoked on the Swing/AWT event thread.

Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - an array of Object identifying the path to the parent of the modified item(s), where the first element of the array is the Object stored at the root node and the last element is the Object stored at the parent node
childIndices - an array of int that specifies the index values of the removed items. The indices must be in sorted order, from lowest to highest
children - an array of Object containing the inserted, removed, or changed objects
See Also:
TreeModelListener.treeNodesChanged(TreeModelEvent)

fireTreeNodesInserted

protected void fireTreeNodesInserted(java.lang.Object source,
                                     java.lang.Object[] path,
                                     int[] childIndices,
                                     java.lang.Object[] children)
Notify all listeners a node has been inserted. The event instance is lazily created using the parameters passed into the fire method.

NOTE: This is a Swing method which must be invoked on the Swing/AWT event thread.

Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - an array of Object identifying the path to the parent of the modified item(s), where the first element of the array is the Object stored at the root node and the last element is the Object stored at the parent node
childIndices - an array of int that specifies the index values of the removed items. The indices must be in sorted order, from lowest to highest
children - an array of Object containing the inserted, removed, or changed objects
See Also:
TreeModelListener.treeNodesChanged(TreeModelEvent)

fireTreeNodesRemoved

protected void fireTreeNodesRemoved(java.lang.Object source,
                                    java.lang.Object[] path,
                                    int[] childIndices,
                                    java.lang.Object[] children)
Notify all listeners that 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.

NOTE: This is a Swing method which must be invoked on the Swing/AWT event thread.

Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - an array of Object identifying the path to the parent of the modified item(s), where the first element of the array is the Object stored at the root node and the last element is the Object stored at the parent node
childIndices - an array of int that specifies the index values of the removed items. The indices must be in sorted order, from lowest to highest
children - an array of Object containing the inserted, removed, or changed objects
See Also:
TreeModelListener.treeNodesChanged(TreeModelEvent), EventListenerList

fireTreeStructureChanged

protected void fireTreeStructureChanged(java.lang.Object[] path)
Notify all listeners that 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.

NOTE: This is a Swing method which must be invoked on the Swing/AWT event thread.

Parameters:
path - an array of Object identifying the path to the parent of the modified item(s), where the first element of the array is the Object stored at the root node and the last element is the Object stored at the parent node
See Also:
TreeModelListener.treeStructureChanged(TreeModelEvent)

fireTreeStructureChanged

protected void fireTreeStructureChanged(java.lang.Object source,
                                        java.lang.Object[] path)
Notify all listeners that 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.

NOTE: This is a Swing method which must be invoked on the Swing/AWT event thread.

Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - an array of Object identifying the path to the parent of the modified item(s), where the first element of the array is the Object stored at the root node and the last element is the Object stored at the parent node
See Also:
TreeModelListener.treeStructureChanged(TreeModelEvent)

fireTreeStructureChanged

public void fireTreeStructureChanged(java.lang.Object source,
                                     java.lang.Object[] path,
                                     int[] childIndices,
                                     java.lang.Object[] children)
Notify all listeners that 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.

NOTE: This is a Swing method which must be invoked on the Swing/AWT event thread.

Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - an array of Object identifying the path to the parent of the modified item(s), where the first element of the array is the Object stored at the root node and the last element is the Object stored at the parent node
childIndices - an array of int that specifies the index values of the removed items. The indices must be in sorted order, from lowest to highest
children - an array of Object containing the inserted, removed, or changed objects
See Also:
TreeModelListener.treeStructureChanged(TreeModelEvent)


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Cookbook