org.dishevelled.observable.graph.impl
Class ObservableGraphImpl<N,E>

java.lang.Object
  extended by org.dishevelled.graph.impl.AbstractGraphDecorator<N,E>
      extended by org.dishevelled.observable.graph.AbstractObservableGraph<N,E>
          extended by org.dishevelled.observable.graph.impl.ObservableGraphImpl<N,E>
Type Parameters:
N - node value type
E - edge value type
All Implemented Interfaces:
Graph<N,E>, ObservableGraph<N,E>

public final class ObservableGraphImpl<N,E>
extends AbstractObservableGraph<N,E>

Observable graph decorator that fires vetoable graph change events in preXxx methods and graph change events in postXxx methods.

Version:
$Revision$ $Date$
Author:
Michael Heuer

Constructor Summary
ObservableGraphImpl(Graph<N,E> graph)
          Create a new observable decorator for the specified graph.
 
Method Summary
protected  void postClear()
          Notify subclasses the clear method has just been called on the wrapped graph.
protected  void postCreateEdge(Node<N,E> source, Node<N,E> target, E value, Edge<N,E> edge)
          Notify subclasses the createEdge method has just been called on the wrapped graph with the specified parameters.
protected  void postCreateNode(N value, Node<N,E> node)
          Notify subclasses the createNode method has just been called on the wrapped graph with the specified parameter.
protected  void postRemove(Edge<N,E> edge)
          Notify subclasses the remove(Edge<N, E>) method has just been called on the wrapped graph with the specified parameter.
protected  void postRemove(Node<N,E> node)
          Notify subclasses the remove(Node<N, E>) method has just been called on the wrapped graph with the specified parameter.
protected  boolean preClear()
          Notify subclasses the clear method is about to be called on the wrapped graph.
protected  boolean preCreateEdge(Node<N,E> source, Node<N,E> target, E value)
          Notify subclasses the createEdge method is about to be called on the wrapped graph with the specified parameters.
protected  boolean preCreateNode(N value)
          Notify subclasses the createNode method is about to be called on the wrapped graph with the specified parameter.
protected  boolean preRemove(Edge<N,E> edge)
          Notify subclasses the remove(Edge<N, E>) method is about to be called on the wrapped graph with the specified parameter.
protected  boolean preRemove(Node<N,E> node)
          Notify subclasses the remove(Node<N, E>) method is about to be called on the wrapped graph with the specified parameter.
 
Methods inherited from class org.dishevelled.observable.graph.AbstractObservableGraph
addGraphChangeListener, addVetoableGraphChangeListener, clear, createEdge, createNode, fireCleared, fireEdgeCreated, fireEdgeRemoved, fireNodeCreated, fireNodeRemoved, fireWillClear, fireWillCreateEdge, fireWillCreateNode, fireWillRemoveEdge, fireWillRemoveNode, getGraphChangeListenerCount, getGraphChangeListeners, getObservableGraphChangeSupport, getVetoableGraphChangeListenerCount, getVetoableGraphChangeListeners, remove, remove, removeGraphChangeListener, removeVetoableGraphChangeListener
 
Methods inherited from class org.dishevelled.graph.impl.AbstractGraphDecorator
edgeCount, edgeMap, edges, edgeValues, forEachEdge, forEachEdge, forEachEdgeValue, forEachEdgeValue, forEachNode, forEachNode, forEachNodeValue, forEachNodeValue, getGraph, isEmpty, nodeCount, nodeMap, nodes, nodeValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.dishevelled.graph.Graph
edgeCount, edgeMap, edges, edgeValues, forEachEdge, forEachEdge, forEachEdgeValue, forEachEdgeValue, forEachNode, forEachNode, forEachNodeValue, forEachNodeValue, isEmpty, nodeCount, nodeMap, nodes, nodeValues
 

Constructor Detail

ObservableGraphImpl

public ObservableGraphImpl(Graph<N,E> graph)
Create a new observable decorator for the specified graph.

Parameters:
graph - graph to decorate, must not be null
Method Detail

preClear

protected boolean preClear()
Notify subclasses the clear method is about to be called on the wrapped graph. Return true to proceed with the change.

Specified by:
preClear in class AbstractObservableGraph<N,E>
Returns:
true to proceed with the change

postClear

protected void postClear()
Notify subclasses the clear method has just been called on the wrapped graph.

Specified by:
postClear in class AbstractObservableGraph<N,E>

preCreateNode

protected boolean preCreateNode(N value)
Notify subclasses the createNode method is about to be called on the wrapped graph with the specified parameter. Return true to proceed with the change.

Specified by:
preCreateNode in class AbstractObservableGraph<N,E>
Parameters:
value - createNode method parameter
Returns:
true to proceed with the change

postCreateNode

protected void postCreateNode(N value,
                              Node<N,E> node)
Notify subclasses the createNode method has just been called on the wrapped graph with the specified parameter.

Specified by:
postCreateNode in class AbstractObservableGraph<N,E>
Parameters:
value - createNode method parameter
node - newly created node

preRemove

protected boolean preRemove(Node<N,E> node)
Notify subclasses the remove(Node<N, E>) method is about to be called on the wrapped graph with the specified parameter. Return true to proceed with the change.

Specified by:
preRemove in class AbstractObservableGraph<N,E>
Parameters:
node - remove(Node<N, E>) method parameter
Returns:
true to proceed with the change

postRemove

protected void postRemove(Node<N,E> node)
Notify subclasses the remove(Node<N, E>) method has just been called on the wrapped graph with the specified parameter.

Specified by:
postRemove in class AbstractObservableGraph<N,E>
Parameters:
node - remove(Node<N, E>) method parameter

preCreateEdge

protected boolean preCreateEdge(Node<N,E> source,
                                Node<N,E> target,
                                E value)
Notify subclasses the createEdge method is about to be called on the wrapped graph with the specified parameters. Return true to proceed with the change.

Specified by:
preCreateEdge in class AbstractObservableGraph<N,E>
Parameters:
source - createEdge method parameter
target - createEdge method parameter
value - createEdge method parameter
Returns:
true to proceed with the change

postCreateEdge

protected void postCreateEdge(Node<N,E> source,
                              Node<N,E> target,
                              E value,
                              Edge<N,E> edge)
Notify subclasses the createEdge method has just been called on the wrapped graph with the specified parameters.

Specified by:
postCreateEdge in class AbstractObservableGraph<N,E>
Parameters:
source - createEdge method parameter
target - createEdge method parameter
value - createEdge method parameter
edge - newly created edge

preRemove

protected boolean preRemove(Edge<N,E> edge)
Notify subclasses the remove(Edge<N, E>) method is about to be called on the wrapped graph with the specified parameter. Return true to proceed with the change.

Specified by:
preRemove in class AbstractObservableGraph<N,E>
Parameters:
edge - remove(Edge<N, E>) method parameter
Returns:
true to proceed with the change

postRemove

protected void postRemove(Edge<N,E> edge)
Notify subclasses the remove(Edge<N, E>) method has just been called on the wrapped graph with the specified parameter.

Specified by:
postRemove in class AbstractObservableGraph<N,E>
Parameters:
edge - remove(Edge<N, E>) method parameter


Copyright (c) 2008-2012 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).