com.tensegrity.graph.event
Class GraphEventMediator

java.lang.Object
  extended bycom.tensegrity.graph.event.GraphEventMediator
All Implemented Interfaces:
EdgeListener, EventListenerTag, GraphListener, NodeListener

public class GraphEventMediator
extends java.lang.Object
implements GraphListener, NodeListener, EdgeListener

The GraphEventMediator facilitates to gain access to all Graph events, Node events and Edge events.

To be informed about all occuring events an object has to implement the GraphEventMediatorListener interface and then registered at a Graph instance as event mediator listener.

The GraphEventMediator is allways an instance variable of a Graph and hasn't to be implemented nor registered to any instance of a GraphObject. This is a mandatory commandment!
An implementation of a Graph allways comes with its own GraphEventMediator implementation, which is a major part of the architecture.

Version:
$Id: GraphEventMediator.java,v 1.10 2005/04/04 07:15:26 MichaelKegel Exp $
Author:
MichaelKegel
See Also:
Graph, GraphEventMediatorListener

Constructor Summary
GraphEventMediator()
          Constructor for GraphEventMediator.
 
Method Summary
 void addMediatorListener(GraphEventMediatorListener listener)
          Adds the GraphEventMediatorListener given by listener to the GraphEventMediator instance such that the listener will be notified about every event that occurs.
 void edgeAdded(GraphEvent graphevent)
          Invoked after an edge was added to the graph.
 void edgeAddedToGraph(EdgeEvent edgeevent)
          This method is invoked on the listener if an Edge was added to the graph.
 void edgeAttachRejected(GraphEvent graphevent)
          An attachment of an edge was rejected by the graph.
 void edgePreAdd(GraphEvent graphevent)
          Invoked when an edge is about to be added to a graph.
 void edgePreRemove(GraphEvent graphevent)
          Invoked when an edge is about to be removed from a graph.
 void edgePreSplit(GraphEvent graphevent)
          An edge is about to be split split and then would be replaced by two new edges.
 void edgeRemoved(GraphEvent graphevent)
          Invoked after an edge was removed from the graph.
 void edgeRemovedFromGraph(EdgeEvent edgeevent)
          This method is invoked on the listener if an Edge was removed from the graph.
 void edgeSplit(GraphEvent graphevent)
          An edge was split and replaced by two new edges.
 java.util.List getListeners()
          Returns a List of the GraphEventMediatorListeners currently registered.
 void nodeAdded(GraphEvent graphevent)
          Invoked after a node was added to the graph.
 void nodeAddedToGraph(NodeEvent nodeevent)
          This method is invoked on the listener if a Node was added to the graph.
 void nodeDeleteEdgeCascade(GraphEvent graphevent)
          A node with indegree = outdegree = 1 was deleted and the adjacent edges are deleted as well.
 void nodePreAdd(GraphEvent graphevent)
          Invoked when a node is about to be added to a graph.
 void nodePreDeleteEdgeCascade(GraphEvent graphevent)
          A node with indegree = outdegree = 1 is about to be deleted and the adjacent edges will be deleted as well.
 void nodePreRemove(GraphEvent graphevent)
          Invoked when a node is about to be removed from a graph.
 void nodeRemoved(GraphEvent graphevent)
          Invoked after a node was removed from the graph.
 void nodeRemovedFromGraph(NodeEvent nodeevent)
          This method is invoked on the listener if a Node was removed from the graph #
 void portAddedToNode(NodeEvent nodeevent)
          This method is invoked on the listener if a Port is added to a Node.
 void portRemovedFromNode(NodeEvent nodeevent)
          This method is invoked on the listener if a Port is removed from a Node.
 void removeMediatorListener(GraphEventMediatorListener listener)
          Removes the GraphEventMediatorListener given by listener from the GraphEventMediator instance such that the listener will no longer be notified about occuring events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphEventMediator

public GraphEventMediator()
Constructor for GraphEventMediator.

Method Detail

addMediatorListener

public void addMediatorListener(GraphEventMediatorListener listener)
Adds the GraphEventMediatorListener given by listener to the GraphEventMediator instance such that the listener will be notified about every event that occurs.

Parameters:
listener - the GraphEventMediatorListener to add

removeMediatorListener

public void removeMediatorListener(GraphEventMediatorListener listener)
Removes the GraphEventMediatorListener given by listener from the GraphEventMediator instance such that the listener will no longer be notified about occuring events.

Parameters:
listener - the GraphEventMediatorListener to remove

getListeners

public java.util.List getListeners()
Returns a List of the GraphEventMediatorListeners currently registered.

Returns:
List the list of the listeners currently registered

nodePreAdd

public void nodePreAdd(GraphEvent graphevent)
Description copied from interface: GraphListener
Invoked when a node is about to be added to a graph.

Specified by:
nodePreAdd in interface GraphListener

nodeAdded

public void nodeAdded(GraphEvent graphevent)
Description copied from interface: GraphListener
Invoked after a node was added to the graph.

Specified by:
nodeAdded in interface GraphListener
Parameters:
graphevent - the graphevent structure carrying graphevent information.

nodePreRemove

public void nodePreRemove(GraphEvent graphevent)
Description copied from interface: GraphListener
Invoked when a node is about to be removed from a graph.

Specified by:
nodePreRemove in interface GraphListener
Parameters:
graphevent - the structure carrying graphevent information.

nodeRemoved

public void nodeRemoved(GraphEvent graphevent)
Description copied from interface: GraphListener
Invoked after a node was removed from the graph.

Specified by:
nodeRemoved in interface GraphListener
Parameters:
graphevent - the structure carrying graphevent information.

edgePreAdd

public void edgePreAdd(GraphEvent graphevent)
Description copied from interface: GraphListener
Invoked when an edge is about to be added to a graph.

Specified by:
edgePreAdd in interface GraphListener
Parameters:
graphevent - the structure carrying graphevent information.

edgeAdded

public void edgeAdded(GraphEvent graphevent)
Description copied from interface: GraphListener
Invoked after an edge was added to the graph.

Specified by:
edgeAdded in interface GraphListener
Parameters:
graphevent - the structure carrying graphevent information.

edgePreRemove

public void edgePreRemove(GraphEvent graphevent)
Description copied from interface: GraphListener
Invoked when an edge is about to be removed from a graph.

Specified by:
edgePreRemove in interface GraphListener
Parameters:
graphevent - the structure carrying graphevent information.

edgeRemoved

public void edgeRemoved(GraphEvent graphevent)
Description copied from interface: GraphListener
Invoked after an edge was removed from the graph.

Specified by:
edgeRemoved in interface GraphListener
Parameters:
graphevent - the structure carrying graphevent information.

edgeAttachRejected

public void edgeAttachRejected(GraphEvent graphevent)
Description copied from interface: GraphListener
An attachment of an edge was rejected by the graph.

Specified by:
edgeAttachRejected in interface GraphListener
Parameters:
graphevent - the structure carrying graphevent information.

edgePreSplit

public void edgePreSplit(GraphEvent graphevent)
Description copied from interface: GraphListener
An edge is about to be split split and then would be replaced by two new edges.

Specified by:
edgePreSplit in interface GraphListener
Parameters:
graphevent - the structure carrying graphevent information.

edgeSplit

public void edgeSplit(GraphEvent graphevent)
Description copied from interface: GraphListener
An edge was split and replaced by two new edges.

Specified by:
edgeSplit in interface GraphListener
Parameters:
graphevent - the structure carrying graphevent information.

nodePreDeleteEdgeCascade

public void nodePreDeleteEdgeCascade(GraphEvent graphevent)
Description copied from interface: GraphListener
A node with indegree = outdegree = 1 is about to be deleted and the adjacent edges will be deleted as well. The two deleted edges will be replaced by a new edge.

Specified by:
nodePreDeleteEdgeCascade in interface GraphListener
Parameters:
graphevent - the structure carrying graphevent information.

nodeDeleteEdgeCascade

public void nodeDeleteEdgeCascade(GraphEvent graphevent)
Description copied from interface: GraphListener
A node with indegree = outdegree = 1 was deleted and the adjacent edges are deleted as well. The two deleted edges were replaced by a new edge.

Specified by:
nodeDeleteEdgeCascade in interface GraphListener
Parameters:
graphevent - the structure carrying graphevent information.

nodeAddedToGraph

public void nodeAddedToGraph(NodeEvent nodeevent)
Description copied from interface: NodeListener
This method is invoked on the listener if a Node was added to the graph.

Specified by:
nodeAddedToGraph in interface NodeListener
Parameters:
nodeevent - the event structure that carries details about the event.

nodeRemovedFromGraph

public void nodeRemovedFromGraph(NodeEvent nodeevent)
Description copied from interface: NodeListener
This method is invoked on the listener if a Node was removed from the graph #

Specified by:
nodeRemovedFromGraph in interface NodeListener
Parameters:
nodeevent - the event structure that carries details about the event.

portAddedToNode

public void portAddedToNode(NodeEvent nodeevent)
Description copied from interface: NodeListener
This method is invoked on the listener if a Port is added to a Node.

Specified by:
portAddedToNode in interface NodeListener
Parameters:
nodeevent - the event structure that carries details about the event.

portRemovedFromNode

public void portRemovedFromNode(NodeEvent nodeevent)
Description copied from interface: NodeListener
This method is invoked on the listener if a Port is removed from a Node.

Specified by:
portRemovedFromNode in interface NodeListener
Parameters:
nodeevent - the event structure that carries details about the event.

edgeAddedToGraph

public void edgeAddedToGraph(EdgeEvent edgeevent)
Description copied from interface: EdgeListener
This method is invoked on the listener if an Edge was added to the graph.

Specified by:
edgeAddedToGraph in interface EdgeListener
Parameters:
edgeevent - the event structure that carries details about the event.

edgeRemovedFromGraph

public void edgeRemovedFromGraph(EdgeEvent edgeevent)
Description copied from interface: EdgeListener
This method is invoked on the listener if an Edge was removed from the graph.

Specified by:
edgeRemovedFromGraph in interface EdgeListener
Parameters:
edgeevent - the event structure that carries details about the event.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.