com.bonevich.erj.diagram
Class ERDiagramGraphModel

java.lang.Object
  |
  +--org.tigris.gef.graph.MutableGraphSupport
        |
        +--com.bonevich.erj.diagram.ERDiagramGraphModel
All Implemented Interfaces:
org.tigris.gef.graph.GraphModel, org.tigris.gef.graph.MutableGraphModel, java.io.Serializable

public class ERDiagramGraphModel
extends org.tigris.gef.graph.MutableGraphSupport
implements org.tigris.gef.graph.MutableGraphModel

This class defines a bridge between the Relational meta-model representation of the database design and the GraphModel interface used by GEF.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.tigris.gef.graph.MutableGraphSupport
_graphListeners
 
Constructor Summary
ERDiagramGraphModel()
           
ERDiagramGraphModel(Schema schema)
           
 
Method Summary
 void addEdge(java.lang.Object edge)
          Add the given edge to the graph, if valid.
 void addNode(java.lang.Object node)
          Add the given node to the graph, if valid.
 void addNodeRelatedEdges(java.lang.Object node)
          Add existing edges that are related to the node.
 boolean canAddEdge(java.lang.Object edge)
          Return true if the given object is a valid edge in this graph
 boolean canAddNode(java.lang.Object node)
          Return true if the given object is a valid node in this graph
 boolean canConnect(java.lang.Object fromP, java.lang.Object toP)
          Return true if the two given ports can be connected by a kind of edge to be determined by the ports.
 java.lang.Object connect(java.lang.Object fromPort, java.lang.Object toPort)
          Contruct and add a new edge of a kind determined by the ports
 java.lang.Object connect(java.lang.Object fromPort, java.lang.Object toPort, java.lang.Class edgeClass)
          Contruct and add a new edge of the given kind
 void fireGraphChanged(java.lang.Object nodeOrEdge)
          This method provides a signature taking a node or edge as an argument (unlike the method in MutableGraphSupport, which takes no arguments).
 java.lang.Object getDestPort(java.lang.Object edge)
          Return the other end of an edge
 java.util.Vector getEdges()
          Return all edges in the graph
 java.util.Vector getInEdges(java.lang.Object port)
          Return all edges going to given port
 java.util.Vector getNodes()
          Return all nodes in the graph
 java.util.Vector getOutEdges(java.lang.Object port)
          Return all edges going from given port
 java.lang.Object getOwner(java.lang.Object port)
          Return the node or edge that owns the given port
 java.util.Vector getPorts(java.lang.Object nodeOrEdge)
          Return all ports on node or edge
 Schema getSchema()
           
 java.lang.Object getSourcePort(java.lang.Object edge)
          Return one end of an edge
 void removeEdge(java.lang.Object edge)
          Remove the given edge from the graph.
 void removeNode(java.lang.Object node)
          Remove the given node from the graph.
 
Methods inherited from class org.tigris.gef.graph.MutableGraphSupport
addGraphEventListener, canConnect, canDragNode, containsEdge, containsEdgePort, containsNode, containsNodePort, containsPort, dragNode, fireEdgeAdded, fireEdgeRemoved, fireGraphChanged, fireNodeAdded, fireNodeRemoved, getGraphListeners, removeGraphEventListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tigris.gef.graph.MutableGraphModel
canConnect, canDragNode, containsEdge, containsNode, dragNode
 
Methods inherited from interface org.tigris.gef.graph.GraphModel
addGraphEventListener, removeGraphEventListener
 

Constructor Detail

ERDiagramGraphModel

public ERDiagramGraphModel()

ERDiagramGraphModel

public ERDiagramGraphModel(Schema schema)
Method Detail

getSchema

public Schema getSchema()

getNodes

public java.util.Vector getNodes()
Return all nodes in the graph

Specified by:
getNodes in interface org.tigris.gef.graph.GraphModel
Specified by:
getNodes in class org.tigris.gef.graph.MutableGraphSupport

getEdges

public java.util.Vector getEdges()
Return all edges in the graph

Specified by:
getEdges in interface org.tigris.gef.graph.GraphModel
Specified by:
getEdges in class org.tigris.gef.graph.MutableGraphSupport

getPorts

public java.util.Vector getPorts(java.lang.Object nodeOrEdge)
Return all ports on node or edge

Specified by:
getPorts in interface org.tigris.gef.graph.GraphModel
Specified by:
getPorts in class org.tigris.gef.graph.MutableGraphSupport

getOwner

public java.lang.Object getOwner(java.lang.Object port)
Return the node or edge that owns the given port

Specified by:
getOwner in interface org.tigris.gef.graph.GraphModel
Specified by:
getOwner in class org.tigris.gef.graph.MutableGraphSupport

getInEdges

public java.util.Vector getInEdges(java.lang.Object port)
Return all edges going to given port

Specified by:
getInEdges in interface org.tigris.gef.graph.GraphModel
Specified by:
getInEdges in class org.tigris.gef.graph.MutableGraphSupport

getOutEdges

public java.util.Vector getOutEdges(java.lang.Object port)
Return all edges going from given port

Specified by:
getOutEdges in interface org.tigris.gef.graph.GraphModel
Specified by:
getOutEdges in class org.tigris.gef.graph.MutableGraphSupport

getSourcePort

public java.lang.Object getSourcePort(java.lang.Object edge)
Return one end of an edge

Specified by:
getSourcePort in interface org.tigris.gef.graph.GraphModel
Specified by:
getSourcePort in class org.tigris.gef.graph.MutableGraphSupport

getDestPort

public java.lang.Object getDestPort(java.lang.Object edge)
Return the other end of an edge

Specified by:
getDestPort in interface org.tigris.gef.graph.GraphModel
Specified by:
getDestPort in class org.tigris.gef.graph.MutableGraphSupport

canAddNode

public boolean canAddNode(java.lang.Object node)
Return true if the given object is a valid node in this graph

Specified by:
canAddNode in interface org.tigris.gef.graph.MutableGraphModel
Specified by:
canAddNode in class org.tigris.gef.graph.MutableGraphSupport

canAddEdge

public boolean canAddEdge(java.lang.Object edge)
Return true if the given object is a valid edge in this graph

Specified by:
canAddEdge in interface org.tigris.gef.graph.MutableGraphModel
Specified by:
canAddEdge in class org.tigris.gef.graph.MutableGraphSupport

addNode

public void addNode(java.lang.Object node)
Add the given node to the graph, if valid.

Specified by:
addNode in interface org.tigris.gef.graph.MutableGraphModel
Specified by:
addNode in class org.tigris.gef.graph.MutableGraphSupport

removeNode

public void removeNode(java.lang.Object node)
Remove the given node from the graph.

Specified by:
removeNode in interface org.tigris.gef.graph.MutableGraphModel
Specified by:
removeNode in class org.tigris.gef.graph.MutableGraphSupport

addEdge

public void addEdge(java.lang.Object edge)
Add the given edge to the graph, if valid.

Specified by:
addEdge in interface org.tigris.gef.graph.MutableGraphModel
Specified by:
addEdge in class org.tigris.gef.graph.MutableGraphSupport

removeEdge

public void removeEdge(java.lang.Object edge)
Remove the given edge from the graph.

Specified by:
removeEdge in interface org.tigris.gef.graph.MutableGraphModel
Specified by:
removeEdge in class org.tigris.gef.graph.MutableGraphSupport

addNodeRelatedEdges

public void addNodeRelatedEdges(java.lang.Object node)
Add existing edges that are related to the node.

Specified by:
addNodeRelatedEdges in interface org.tigris.gef.graph.MutableGraphModel
Specified by:
addNodeRelatedEdges in class org.tigris.gef.graph.MutableGraphSupport

canConnect

public boolean canConnect(java.lang.Object fromP,
                          java.lang.Object toP)
Return true if the two given ports can be connected by a kind of edge to be determined by the ports.

Specified by:
canConnect in interface org.tigris.gef.graph.MutableGraphModel
Specified by:
canConnect in class org.tigris.gef.graph.MutableGraphSupport

connect

public java.lang.Object connect(java.lang.Object fromPort,
                                java.lang.Object toPort)
Contruct and add a new edge of a kind determined by the ports

Specified by:
connect in interface org.tigris.gef.graph.MutableGraphModel
Specified by:
connect in class org.tigris.gef.graph.MutableGraphSupport

connect

public java.lang.Object connect(java.lang.Object fromPort,
                                java.lang.Object toPort,
                                java.lang.Class edgeClass)
Contruct and add a new edge of the given kind

Specified by:
connect in interface org.tigris.gef.graph.MutableGraphModel
Overrides:
connect in class org.tigris.gef.graph.MutableGraphSupport

fireGraphChanged

public void fireGraphChanged(java.lang.Object nodeOrEdge)
This method provides a signature taking a node or edge as an argument (unlike the method in MutableGraphSupport, which takes no arguments).



Copyright © 2001-2003 bonevich.com. All Rights Reserved.