com.phoenixst.plexus.util
public class ForwardingGraphListener extends Object implements GraphListener
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 $
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) |
void | edgeRemoved(GraphEvent event) |
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) |
void | nodeRemoved(GraphEvent event) |
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.