org.argouml.uml.diagram.sequence
Class SequenceDiagramGraphModel

java.lang.Object
  extended byorg.tigris.gef.graph.MutableGraphSupport
      extended byorg.argouml.uml.diagram.UMLMutableGraphSupport
          extended byorg.argouml.uml.diagram.sequence.SequenceDiagramGraphModel
All Implemented Interfaces:
org.tigris.gef.graph.BaseGraphModel, EventListener, org.tigris.gef.graph.GraphModel, org.tigris.gef.graph.MutableGraphModel, Serializable, VetoableChangeListener

public class SequenceDiagramGraphModel
extends UMLMutableGraphSupport
implements VetoableChangeListener

This class defines a bridge between the UML meta-model representation of the design and the GraphModel interface used by GEF. This class handles only UML Sequence Digrams.

See Also:
Serialized Form

Nested Class Summary
private  class SequenceDiagramGraphModel.CanConnectCallActionCmd
           
private  class SequenceDiagramGraphModel.CanConnectCmd
           
private  class SequenceDiagramGraphModel.CanConnectCreateActionCmd
           
private  class SequenceDiagramGraphModel.CanConnectDestroyActionCmd
           
private  class SequenceDiagramGraphModel.CanConnectReturnActionCmd
           
 
Field Summary
private  Object collaboration
          The collaboration this sequence diagram belongs too.
private  Object interaction
          The interaction that is shown on the sequence diagram
private static Logger LOG
          Logger.
 
Fields inherited from class org.argouml.uml.diagram.UMLMutableGraphSupport
 
Fields inherited from class org.tigris.gef.graph.MutableGraphSupport
 
Constructor Summary
SequenceDiagramGraphModel(Object c)
          Default constructor.
 
Method Summary
 void addEdge(Object edge)
          Adds an edge to the model if this is allowed.
 void addNode(Object node)
          Add the given node to the graph, if valid.
 void addNodeRelatedEdges(Object node)
           
 boolean canAddEdge(Object edge)
          Return true if the given object is a valid edge in this graph.
 boolean canAddNode(Object node)
          Return true if the given object is a valid node in this graph.
 boolean canConnect(Object fromP, Object toP)
          Return true if the two given ports can be connected by a kind of edge to be determined by the ports.
 Object connect(Object fromPort, Object toPort, Class edgeType)
          Creates a link based on the given from and toPort.
 Object getCollaboration()
          Gets the collaboration that is shown on the sequence diagram.
 List getEdges()
          Return all edges in the graph.
 List getInEdges(Object port)
          Return all edges going to given port.
private  Object getInteraction()
           
 Object getNamespace()
           
 List getNodes()
          Return all nodes in the graph.
 List getOutEdges(Object port)
          Return all edges going from given port.
 Object getOwner(Object port)
          Return the node or edge that owns the given port.
 List getPorts(Object nodeOrEdge)
          Return all ports on node or edge.
 void setCollaboration(Object c)
          Sets the collaboration that is shown at the sequence diagram.
 void vetoableChange(PropertyChangeEvent pce)
           
 
Methods inherited from class org.argouml.uml.diagram.UMLMutableGraphSupport
buildCommentConnection, buildConnection, connect, constainsEdge, containsNode, getDestPort, getSourcePort, isConnectionValid, removeEdge, removeNode
 
Methods inherited from class org.tigris.gef.graph.MutableGraphSupport
addGraphEventListener, canChangeConnectedNode, canConnect, canDragNode, changeConnectedNode, containsEdge, containsEdgePort, containsNodePort, containsPort, createNode, dragNode, fireEdgeAdded, fireEdgeRemoved, fireGraphChanged, fireNodeAdded, fireNodeRemoved, getConnectionConstrainer, getGraphListeners, removeAll, removeAllEdges, removeAllNodes, removeFig, removeGraphEventListener, setConnectionConstrainer, setSaveAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Logger LOG
Logger.


collaboration

private Object collaboration
The collaboration this sequence diagram belongs too.


interaction

private Object interaction
The interaction that is shown on the sequence diagram

Constructor Detail

SequenceDiagramGraphModel

public SequenceDiagramGraphModel(Object c)
Default constructor. Constructs a model and a collaboration in the root of the current project.

Parameters:
c - the collaboration
Method Detail

getNodes

public List getNodes()
Return all nodes in the graph.

Specified by:
getNodes in interface org.tigris.gef.graph.GraphModel
Overrides:
getNodes in class UMLMutableGraphSupport
Returns:
Vector of nodes in the graphmodel/diagram
See Also:
GraphModel.getNodes()

getEdges

public List getEdges()
Return all edges in the graph.

Specified by:
getEdges in interface org.tigris.gef.graph.GraphModel
Overrides:
getEdges in class UMLMutableGraphSupport
Returns:
Vector of edges in the graphmodel/diagram
See Also:
GraphModel.getEdges()

getPorts

public List getPorts(Object nodeOrEdge)
Return all ports on node or edge.

Specified by:
getPorts in interface org.tigris.gef.graph.GraphModel
See Also:
GraphModel.getPorts(java.lang.Object)

getOwner

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

Specified by:
getOwner in interface org.tigris.gef.graph.BaseGraphModel
See Also:
BaseGraphModel.getOwner(java.lang.Object)

getInEdges

public List getInEdges(Object port)
Return all edges going to given port.

Specified by:
getInEdges in interface org.tigris.gef.graph.GraphModel
See Also:
GraphModel.getInEdges(java.lang.Object)

getOutEdges

public List getOutEdges(Object port)
Return all edges going from given port.

Specified by:
getOutEdges in interface org.tigris.gef.graph.GraphModel
See Also:
GraphModel.getOutEdges(java.lang.Object)

canAddNode

public boolean canAddNode(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
Overrides:
canAddNode in class UMLMutableGraphSupport
See Also:
MutableGraphModel.canAddNode(java.lang.Object)

canAddEdge

public boolean canAddEdge(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
Overrides:
canAddEdge in class UMLMutableGraphSupport
See Also:
MutableGraphModel.canAddEdge(java.lang.Object)

addNode

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

Specified by:
addNode in interface org.tigris.gef.graph.MutableGraphModel
See Also:
MutableGraphModel.addNode(java.lang.Object)

addEdge

public void addEdge(Object edge)
Adds an edge to the model if this is allowed. If the edge is a link, an associationrole and a stimulus to accompany this link are build.

Specified by:
addEdge in interface org.tigris.gef.graph.MutableGraphModel
See Also:
MutableGraphModel.addEdge(java.lang.Object)

addNodeRelatedEdges

public void addNodeRelatedEdges(Object node)
Specified by:
addNodeRelatedEdges in interface org.tigris.gef.graph.MutableGraphModel
Overrides:
addNodeRelatedEdges in class UMLMutableGraphSupport
See Also:
MutableGraphModel.addNodeRelatedEdges(java.lang.Object)

canConnect

public boolean canConnect(Object fromP,
                          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
Overrides:
canConnect in class UMLMutableGraphSupport
See Also:
MutableGraphModel.canConnect( java.lang.Object, java.lang.Object)

connect

public Object connect(Object fromPort,
                      Object toPort,
                      Class edgeType)
Creates a link based on the given from and toPort. The fromPort should allways point to a LinkCoordinates instance. The toPort can point to a LinkCoordinates instance or to a Object instance. On a sequence diagram you can only draw Links. So other edgeClasses then links are not supported.

Specified by:
connect in interface org.tigris.gef.graph.MutableGraphModel
Overrides:
connect in class UMLMutableGraphSupport
Parameters:
fromPort - The originating port to connect
toPort - The destination port to connect
edgeType - The NSUML type of edge to create.
Returns:
The type of edge created (the same as edgeClass if we succeeded, null otherwise)
See Also:
MutableGraphModel.connect( Object, Object, Class)

vetoableChange

public void vetoableChange(PropertyChangeEvent pce)
Specified by:
vetoableChange in interface VetoableChangeListener
See Also:
VetoableChangeListener.vetoableChange(java.beans.PropertyChangeEvent)

getCollaboration

public Object getCollaboration()
Gets the collaboration that is shown on the sequence diagram.

Returns:
the collaboration of the diagram.

setCollaboration

public void setCollaboration(Object c)
Sets the collaboration that is shown at the sequence diagram.

Parameters:
c - the collaboration

getInteraction

private Object getInteraction()

getNamespace

public Object getNamespace()
Specified by:
getNamespace in class UMLMutableGraphSupport
Returns:
the namespace of the diagram
See Also:
UMLMutableGraphSupport.getNamespace()


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook