diva.graph
Class AbstractGraphModel

java.lang.Object
  extended by diva.graph.AbstractGraphModel
All Implemented Interfaces:
GraphModel
Direct Known Subclasses:
ModularGraphModel

public abstract class AbstractGraphModel
extends Object
implements GraphModel

An abstract implementation of the GraphModel interface that provides the basic event notification system

Version:
$Revision: 1.5 $
Author:
Steve Neuendorffer (neuenodr@eecs.berkeley.edu)

Field Summary
protected  GraphEventMulticaster _graphListeners
          The list of graph listeners.
 
Constructor Summary
AbstractGraphModel()
           
 
Method Summary
 void addGraphListener(GraphListener l)
          Add a graph listener to the model.
 void dispatchGraphEvent(GraphEvent e)
          Send an graph event to all of the graph listeners.
 void removeGraphListener(GraphListener l)
          Remove the given listener from this graph model.
 void setDispatchEnabled(boolean val)
          Turn on/off all event dispatches from this graph model, for use in an inner-loop algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface diva.graph.GraphModel
containsNode, getHead, getNodeCount, getParent, getProperty, getRoot, getSemanticObject, getTail, inEdges, isComposite, isDirected, isEdge, isNode, nodes, outEdges, setProperty, setSemanticObject
 

Field Detail

_graphListeners

protected GraphEventMulticaster _graphListeners
The list of graph listeners.

Constructor Detail

AbstractGraphModel

public AbstractGraphModel()
Method Detail

addGraphListener

public void addGraphListener(GraphListener l)
Add a graph listener to the model. Graph listeners are notified with a GraphEvent any time the graph is modified.

Specified by:
addGraphListener in interface GraphModel

dispatchGraphEvent

public void dispatchGraphEvent(GraphEvent e)
Send an graph event to all of the graph listeners. This allows manual control of sending graph graph events, or allows the user to send a STRUCTURE_CHANGED after some inner-loop operations.

This method furthermore ensures that all graph events are dispatched in the event thread.

Specified by:
dispatchGraphEvent in interface GraphModel
See Also:
setDispatchEnabled(boolean)

removeGraphListener

public void removeGraphListener(GraphListener l)
Remove the given listener from this graph model. The listener will no longer be notified of changes to the graph.

Specified by:
removeGraphListener in interface GraphModel

setDispatchEnabled

public void setDispatchEnabled(boolean val)
Turn on/off all event dispatches from this graph model, for use in an inner-loop algorithm. When turning dispatch back on again, if the client has made changes that listeners should know about, he should create an appropriate STRUCTURE_CHANGED and dispatch it using the dispatchGraphEvent() method.

Specified by:
setDispatchEnabled in interface GraphModel
See Also:
dispatchGraphEvent(GraphEvent)


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.