|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.peace_tools.data.DataSetTreeModel
public class DataSetTreeModel
A bridge class between a Workspace and a JTree.
This class serves as a bridge between the in-memory representation of a
Workspace (represented by the set of classes in the workspace
package. This class enables reusing the data set hierarchy maintained by
the Workspace object to display it in a JTree. In addition, this class
also acts to monitor and update data set views.
| Field Summary | |
|---|---|
private java.util.ArrayList<javax.swing.event.TreeModelListener> |
treeModelListeners
The list of tree mode listeners that were added to this tree model. |
| Constructor Summary | |
|---|---|
DataSetTreeModel()
The default constructor. |
|
| Method Summary | |
|---|---|
void |
addTreeModelListener(javax.swing.event.TreeModelListener tml)
Adds a listener to be notified when the data associated with the data set changes. |
protected void |
fireTreeStructureChanged(java.lang.Object oldRoot)
The only event raised by this model is TreeStructureChanged with the appropriate entry to be |
java.lang.Object |
getChild(java.lang.Object parent,
int index)
This method provides the actual child object to be displayed in a JTree depending on the data in the Workspace. |
int |
getChildCount(java.lang.Object parent)
This method provides the child count depending on the data in the Workspace. |
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
This method provides the zero-based logical index of a child node. |
javax.swing.tree.TreePath |
getPath(java.lang.Object entry)
This is a helper method to determine path to a given entry. |
java.lang.Object |
getRoot()
Obtain the root of the data set tree. |
boolean |
isLeaf(java.lang.Object entry)
Method to determine if a given entry is a leaf object. |
void |
removeTreeModelListener(javax.swing.event.TreeModelListener tml)
Removes a listener from the list of listeners maintained by this class. |
void |
valueForPathChanged(javax.swing.tree.TreePath arg0,
java.lang.Object arg1)
This data model is meant to be used with a read-only type JTree. |
void |
workspaceChanged(WorkspaceEvent event)
This method is invoked on all workspace listeners registered with the current Workspace. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.ArrayList<javax.swing.event.TreeModelListener> treeModelListeners
| Constructor Detail |
|---|
public DataSetTreeModel()
| Method Detail |
|---|
public void addTreeModelListener(javax.swing.event.TreeModelListener tml)
addTreeModelListener in interface javax.swing.tree.TreeModeltml - The listener to be added to the list of listeners to
be notified when the data associated with the workspace changes.public void removeTreeModelListener(javax.swing.event.TreeModelListener tml)
removeTreeModelListener in interface javax.swing.tree.TreeModeltml - The listener to be removed from the list of listeners
to receive updates.
public java.lang.Object getChild(java.lang.Object parent,
int index)
getChild in interface javax.swing.tree.TreeModelparent - The object whose child is to be returned.index - The index of the child to be returned by this method.TreeModel.getChildCount(java.lang.Object)public int getChildCount(java.lang.Object parent)
getChildCount in interface javax.swing.tree.TreeModelparent - The object whose child counts is to be determined.TreeModel.getChildCount(java.lang.Object)
public int getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
getIndexOfChild in interface javax.swing.tree.TreeModelparent - The object whose child counts is to be determined.TreeModel.getChildCount(java.lang.Object)public java.lang.Object getRoot()
getRoot in interface javax.swing.tree.TreeModelpublic boolean isLeaf(java.lang.Object entry)
isLeaf in interface javax.swing.tree.TreeModel
public void valueForPathChanged(javax.swing.tree.TreePath arg0,
java.lang.Object arg1)
valueForPathChanged in interface javax.swing.tree.TreeModelpublic javax.swing.tree.TreePath getPath(java.lang.Object entry)
entry - The entry for which the tree path is required.
protected void fireTreeStructureChanged(java.lang.Object oldRoot)
public void workspaceChanged(WorkspaceEvent event)
WorkspaceListener
workspaceChanged in interface WorkspaceListenerevent - The event that contains the information regarding the
change that has occured to the workspace.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||