org.archiviststoolkit.swing
Class WorkSurfaceTreeModel

java.lang.Object
  extended by org.archiviststoolkit.swing.WorkSurfaceTreeModel
All Implemented Interfaces:
javax.swing.tree.TreeModel

public class WorkSurfaceTreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel

An important part of the Workbench gui is the tree which displays all accessible worksurfaces. This tree is supported by this the workbench tree model


Constructor Summary
WorkSurfaceTreeModel()
          Default constructor, currently does nothing.
 
Method Summary
 void add(WorkSurface worksurface)
          Add a new Item to the tree model.
 void addTreeModelListener(javax.swing.event.TreeModelListener listener)
          Adds a listener for the TreeModelEvent posted after the tree changes.
protected  void fireTreeStructureChanged(java.lang.Object oldRoot)
          Tell all the listeners that the tree has changed.
 java.lang.Object getChild(java.lang.Object parent, int index)
          Get the object which exists as a child at index of the parent.
 int getChildCount(java.lang.Object parent)
          Get the number of children this parent supports.
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
          Get the child index of the named object.
 java.lang.Object getRoot()
          Get the root object.
 boolean isLeaf(java.lang.Object node)
          Returns if this is a leaf object.
 void refresh()
          Refresh any JTree components which are dependent on this model.
 void removeTreeModelListener(javax.swing.event.TreeModelListener listener)
          Removes a listener previously added with addTreeModelListener().
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newVal)
          Notifys the model that the value for the path has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkSurfaceTreeModel

public WorkSurfaceTreeModel()
Default constructor, currently does nothing.

Method Detail

add

public final void add(WorkSurface worksurface)
Add a new Item to the tree model.

Parameters:
worksurface - the item to add

refresh

public final void refresh()
Refresh any JTree components which are dependent on this model.


fireTreeStructureChanged

protected final void fireTreeStructureChanged(java.lang.Object oldRoot)
Tell all the listeners that the tree has changed.

Parameters:
oldRoot - the root from which this has changed

addTreeModelListener

public final void addTreeModelListener(javax.swing.event.TreeModelListener listener)
Adds a listener for the TreeModelEvent posted after the tree changes.

Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel
Parameters:
listener - the listener to add

removeTreeModelListener

public final void removeTreeModelListener(javax.swing.event.TreeModelListener listener)
Removes a listener previously added with addTreeModelListener().

Specified by:
removeTreeModelListener in interface javax.swing.tree.TreeModel
Parameters:
listener - the listener to remove

getChild

public final java.lang.Object getChild(java.lang.Object parent,
                                       int index)
Get the object which exists as a child at index of the parent.

Specified by:
getChild in interface javax.swing.tree.TreeModel
Parameters:
parent - the parent object
index - the index of the child
Returns:
the object at the parents index

getChildCount

public final int getChildCount(java.lang.Object parent)
Get the number of children this parent supports.

Specified by:
getChildCount in interface javax.swing.tree.TreeModel
Parameters:
parent - the parent for which we want the count
Returns:
the number of children

getIndexOfChild

public final int getIndexOfChild(java.lang.Object parent,
                                 java.lang.Object child)
Get the child index of the named object.

Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel
Parameters:
parent - the parent of the child were talking about
child - the child which we are talking about
Returns:
the index of the child

getRoot

public final java.lang.Object getRoot()
Get the root object.

Specified by:
getRoot in interface javax.swing.tree.TreeModel
Returns:
the root object

isLeaf

public final boolean isLeaf(java.lang.Object node)
Returns if this is a leaf object.

Specified by:
isLeaf in interface javax.swing.tree.TreeModel
Parameters:
node - the node which we are testing
Returns:
true if the node is a leaf in the tree model

valueForPathChanged

public final void valueForPathChanged(javax.swing.tree.TreePath path,
                                      java.lang.Object newVal)
Notifys the model that the value for the path has changed. Only implemented in this case to keep with the TreeModel contract.

Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel
Parameters:
path - the treepath
newVal - the value for this node