Package diva.graph

Class 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
    • 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)