Plexus v0.13.1

com.phoenixst.plexus.util
Class ForwardingGraphListener

java.lang.Object
  extended by com.phoenixst.plexus.util.ForwardingGraphListener
All Implemented Interfaces:
GraphListener, EventListener
Direct Known Subclasses:
FilteredGraphListener, TransformingGraphListener

public class ForwardingGraphListener
extends Object
implements GraphListener

A GraphListener which forwards events to an ObservableGraphDelegate. Instances of this class only keep a WeakReference to their delegates. If that Reference has been cleared when an event is received, this listener will remove itself as a listener of the Graph which sent the event. Because of this, it is necessary for the Graph which is using this listener to maintain a strong reference to the ObservableGraphDelegate.

Since:
1.0
Version:
$Revision: 1.3 $
Author:
Ray A. Conner

Constructor Summary
ForwardingGraphListener(ObservableGraphDelegate observableDelegate)
           
 
Method Summary
protected  boolean checkDelegate(GraphEvent event)
          Returns true only if the Reference has not been cleared and the delegate currently has listeners.
 void edgeAdded(GraphEvent event)
          Invoked when an edge has been added to the Graph.
 void edgeRemoved(GraphEvent event)
          Invoked when an edge has been removed from the Graph.
protected  void fireEdgeAdded(Graph.Edge edge)
           
protected  void fireEdgeRemoved(Graph.Edge edge)
           
protected  void fireNodeAdded(Object node)
           
protected  void fireNodeRemoved(Object node)
           
 void nodeAdded(GraphEvent event)
          Invoked when a node has been added to the Graph.
 void nodeRemoved(GraphEvent event)
          Invoked when a node has been removed from the Graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForwardingGraphListener

public ForwardingGraphListener(ObservableGraphDelegate observableDelegate)
Method Detail

checkDelegate

protected final boolean checkDelegate(GraphEvent event)
Returns true only if the Reference has not been cleared and the delegate currently has listeners. If the Reference has been cleared, then this listener is removed as a listener from the source of the event before returning false. This method should be called by any public method of this class prior to performing any actual work.


fireNodeAdded

protected final void fireNodeAdded(Object node)

fireNodeRemoved

protected final void fireNodeRemoved(Object node)

fireEdgeAdded

protected final void fireEdgeAdded(Graph.Edge edge)

fireEdgeRemoved

protected final void fireEdgeRemoved(Graph.Edge edge)

nodeAdded

public void nodeAdded(GraphEvent event)
Description copied from interface: GraphListener
Invoked when a node has been added to the Graph.

Specified by:
nodeAdded in interface GraphListener

nodeRemoved

public void nodeRemoved(GraphEvent event)
Description copied from interface: GraphListener
Invoked when a node has been removed from the Graph.

Specified by:
nodeRemoved in interface GraphListener

edgeAdded

public void edgeAdded(GraphEvent event)
Description copied from interface: GraphListener
Invoked when an edge has been added to the Graph.

Specified by:
edgeAdded in interface GraphListener

edgeRemoved

public void edgeRemoved(GraphEvent event)
Description copied from interface: GraphListener
Invoked when an edge has been removed from the Graph.

Specified by:
edgeRemoved in interface GraphListener

Plexus v0.13.1

See the Plexus project home, hosted by SourceForge.
Copyright ? 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.