Package diva.graph
Class AbstractGraphModel
- java.lang.Object
-
- diva.graph.AbstractGraphModel
-
- All Implemented Interfaces:
GraphModel
- Direct Known Subclasses:
ModularGraphModel
public abstract class AbstractGraphModel extends java.lang.Object implements GraphModel
An abstract implementation of the GraphModel interface that provides the basic event notification system- Version:
- $Id$
- Author:
- Steve Neuendorffer, Contributor Bert Rodiers
- Pt.AcceptedRating:
- Red
-
-
Field Summary
Fields Modifier and Type Field Description protected GraphEventMulticaster
_graphListeners
The list of graph listeners.
-
Constructor Summary
Constructors Constructor Description AbstractGraphModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, nodesAfterEdges, nodesBeforeEdges, outEdges, setProperty, setSemanticObject
-
-
-
-
Field Detail
-
_graphListeners
protected GraphEventMulticaster _graphListeners
The list of graph listeners.
-
-
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 interfaceGraphModel
-
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 interfaceGraphModel
- 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 interfaceGraphModel
-
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 interfaceGraphModel
- See Also:
dispatchGraphEvent(GraphEvent)
-
-