Class SketchAdapter.JGraphListener

  extended by easik.sketch.util.SketchAdapter.JGraphListener
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, org.jgraph.event.GraphModelListener
Enclosing class:

private class SketchAdapter.JGraphListener
extends java.lang.Object
implements org.jgraph.event.GraphModelListener, java.io.Serializable

Inner class listening to the GraphModel. If something is changed in the GraphModel, this Listener gets notified and propagates the change back to the JGraphT graph, if it didn't originate there.

If this change contains changes that would make this an illegal JGraphT graph, like adding an edge that is incident with only one vertex, the illegal parts of the change are undone.

Field Summary
private  Sketch _ourSketch
          The sketch
Constructor Summary
SketchAdapter.JGraphListener(Sketch inSketch)
          Default constructor
Method Summary
private  void filterEdgesAndVertices(java.lang.Object[] allCells, java.util.Set jEdges, java.util.Set jVertices)
          Filters an array of JGraph GraphCell objects into edges and vertices.
 void graphChanged(org.jgraph.event.GraphModelEvent e)
          This method is called for all JGraph changes.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


private Sketch _ourSketch
The sketch

Constructor Detail


public SketchAdapter.JGraphListener(Sketch inSketch)
Default constructor

inSketch - The sketch
Method Detail


public void graphChanged(org.jgraph.event.GraphModelEvent e)
This method is called for all JGraph changes.

Specified by:
graphChanged in interface org.jgraph.event.GraphModelListener
e -


private void filterEdgesAndVertices(java.lang.Object[] allCells,
                                    java.util.Set jEdges,
                                    java.util.Set jVertices)
Filters an array of JGraph GraphCell objects into edges and vertices. Ports and 'groups' are thrown away.

allCells - Array of cells to be filtered. These are just plain Objects in principle, but if they aren't GraphCells we can't detect what they are. So we ignore the non-GraphCell elements.
jEdges - Set to which all edges are added.
jVertices - Set to which all vertices are added.