com.phoenixst.plexus.util

Class ForwardingGraphListener

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 booleancheckDelegate(GraphEvent event)
Returns true only if the Reference has not been cleared and the delegate currently has listeners.
voidedgeAdded(GraphEvent event)
voidedgeRemoved(GraphEvent event)
protected voidfireEdgeAdded(Graph.Edge edge)
protected voidfireEdgeRemoved(Graph.Edge edge)
protected voidfireNodeAdded(Object node)
protected voidfireNodeRemoved(Object node)
voidnodeAdded(GraphEvent event)
voidnodeRemoved(GraphEvent event)

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.

edgeAdded

public void edgeAdded(GraphEvent event)

edgeRemoved

public void edgeRemoved(GraphEvent event)

fireEdgeAdded

protected final void fireEdgeAdded(Graph.Edge edge)

fireEdgeRemoved

protected final void fireEdgeRemoved(Graph.Edge edge)

fireNodeAdded

protected final void fireNodeAdded(Object node)

fireNodeRemoved

protected final void fireNodeRemoved(Object node)

nodeAdded

public void nodeAdded(GraphEvent event)

nodeRemoved

public void nodeRemoved(GraphEvent event)
See the Plexus project home, hosted by SourceForge.
Copyright B) 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.