uk.ac.ucl.cs.emofocl.jmibrowser
Class DAGTreeModel

java.lang.Object
  extended by uk.ac.ucl.cs.emofocl.jmibrowser.DAGTreeModel
All Implemented Interfaces:
TreeModel
Direct Known Subclasses:
JMITreeModel

public abstract class DAGTreeModel
extends Object
implements TreeModel

Manages a tree to represent a rooted directed acyclic graph

Author:
jwskene

Constructor Summary
protected DAGTreeModel()
           
 
Method Summary
protected  int addChild(DAGNode parent, Object child, boolean fire)
           
protected  void addLink(Object parent, Object child, boolean fire)
           
 void addTreeModelListener(TreeModelListener l)
           
 void fireNodesChanged(TreeModelEvent e)
           
 void fireNodesInserted(TreeModelEvent e)
           
 void fireNodesRemoved(TreeModelEvent e)
           
 void fireStructureChanged(TreeModelEvent e)
           
 Object getChild(Object parent, int index)
           
 int getChildCount(Object parent)
           
protected  Object[] getChildren(DAGNode parent)
           
 int getIndexOfChild(Object parent, Object child)
           
protected  Object[][] getPaths(Object object)
          Returns the set of all paths from the root
 Object getRoot()
           
 boolean isLeaf(Object node)
           
protected abstract  void nodeUnreachable(Object node)
          Callback when a node becomes unreachable.
protected abstract  void populateNode(DAGNode parent)
          This method should be overridden to find children if they are not previously known.
protected  void removeLink(Object parent, Object child)
           
protected  int removeNode(DAGNode node)
           
protected  int removeNode(DAGNode node, boolean fire)
           
 void removeTreeModelListener(TreeModelListener l)
           
protected  void setLink(Object parent, Object child)
           
 void setRoot(Object root)
           
 void valueForPathChanged(TreePath path, Object newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DAGTreeModel

protected DAGTreeModel()
Method Detail

getRoot

public Object getRoot()
Specified by:
getRoot in interface TreeModel
See Also:
TreeModel.getRoot()

setRoot

public void setRoot(Object root)

getChildren

protected Object[] getChildren(DAGNode parent)

populateNode

protected abstract void populateNode(DAGNode parent)
This method should be overridden to find children if they are not previously known.

Parameters:
parent -

addLink

protected void addLink(Object parent,
                       Object child,
                       boolean fire)

removeLink

protected void removeLink(Object parent,
                          Object child)

setLink

protected void setLink(Object parent,
                       Object child)

addChild

protected int addChild(DAGNode parent,
                       Object child,
                       boolean fire)

removeNode

protected int removeNode(DAGNode node)

removeNode

protected int removeNode(DAGNode node,
                         boolean fire)

nodeUnreachable

protected abstract void nodeUnreachable(Object node)
Callback when a node becomes unreachable. Allows listeners to be removed.

Parameters:
node -

getPaths

protected Object[][] getPaths(Object object)
Returns the set of all paths from the root

Parameters:
child -
Returns:

getChild

public Object getChild(Object parent,
                       int index)
Specified by:
getChild in interface TreeModel
See Also:
TreeModel.getChild(java.lang.Object, int)

getChildCount

public int getChildCount(Object parent)
Specified by:
getChildCount in interface TreeModel
See Also:
TreeModel.getChildCount(java.lang.Object)

isLeaf

public boolean isLeaf(Object node)
Specified by:
isLeaf in interface TreeModel
See Also:
TreeModel.isLeaf(java.lang.Object)

valueForPathChanged

public void valueForPathChanged(TreePath path,
                                Object newValue)
Specified by:
valueForPathChanged in interface TreeModel
See Also:
TreeModel.valueForPathChanged(javax.swing.tree.TreePath, java.lang.Object)

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Specified by:
getIndexOfChild in interface TreeModel
See Also:
TreeModel.getIndexOfChild(java.lang.Object, java.lang.Object)

addTreeModelListener

public void addTreeModelListener(TreeModelListener l)
Specified by:
addTreeModelListener in interface TreeModel
See Also:
TreeModel.addTreeModelListener(javax.swing.event.TreeModelListener)

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener l)
Specified by:
removeTreeModelListener in interface TreeModel
See Also:
TreeModel.removeTreeModelListener(javax.swing.event.TreeModelListener)

fireNodesChanged

public void fireNodesChanged(TreeModelEvent e)
See Also:
TreeModelListener.treeNodesChanged(javax.swing.event.TreeModelEvent)

fireNodesInserted

public void fireNodesInserted(TreeModelEvent e)
See Also:
TreeModelListener.treeNodesInserted(javax.swing.event.TreeModelEvent)

fireNodesRemoved

public void fireNodesRemoved(TreeModelEvent e)
See Also:
TreeModelListener.treeNodesRemoved(javax.swing.event.TreeModelEvent)

fireStructureChanged

public void fireStructureChanged(TreeModelEvent e)
See Also:
TreeModelListener.treeStructureChanged(javax.swing.event.TreeModelEvent)