org.argouml.uml.diagram.state
Class StateDiagramGraphModel

java.lang.Object
  |
  +--MutableGraphSupport
        |
        +--org.argouml.uml.diagram.UMLMutableGraphSupport
              |
              +--org.argouml.uml.diagram.state.StateDiagramGraphModel
All Implemented Interfaces:
java.util.EventListener, java.beans.VetoableChangeListener

public class StateDiagramGraphModel
extends UMLMutableGraphSupport
implements java.beans.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 MState Digrams.

See Also:
Serialized Form

Field Summary
protected  MStateMachine _machine
          The statemachine we are diagramming
protected  MNamespace _namespace
          The "home" UML model of this diagram, not all ModelElements in this graph are in the home model, but if they are added and don't already have a model, they are placed in the "home model".
protected static Category cat
           
 
Fields inherited from class org.argouml.uml.diagram.UMLMutableGraphSupport
_edges, _nodes
 
Constructor Summary
StateDiagramGraphModel()
           
 
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)
           
 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 canChangeConnectedNode(java.lang.Object newNode, java.lang.Object oldNode, java.lang.Object edge)
           
 boolean canConnect(java.lang.Object fromPort, java.lang.Object toPort)
          Return true if the two given ports can be connected by a kind of edge to be determined by the ports.
 void changeConnectedNode(java.lang.Object newNode, java.lang.Object oldNode, java.lang.Object edge, boolean isSource)
          Reroutes the connection to the old node to be connected to the new node.
 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
 java.lang.Object getDestPort(java.lang.Object edge)
          Return the other end of an edge
 java.util.Vector getInEdges(java.lang.Object port)
          Return all edges going to given port
 MStateMachine getMachine()
           
 MNamespace getNamespace()
           
 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
 java.lang.Object getSourcePort(java.lang.Object edge)
          Return one end of an edge
 void setMachine(MStateMachine sm)
           
 void setNamespace(MNamespace m)
           
 void vetoableChange(java.beans.PropertyChangeEvent pce)
           
 
Methods inherited from class org.argouml.uml.diagram.UMLMutableGraphSupport
connect, constainsEdge, containsNode, getEdges, getNodes, removeEdge, removeNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected static Category cat

_namespace

protected MNamespace _namespace
The "home" UML model of this diagram, not all ModelElements in this graph are in the home model, but if they are added and don't already have a model, they are placed in the "home model". Also, elements from other models will have their FigNodes add a line to say what their model is.


_machine

protected MStateMachine _machine
The statemachine we are diagramming

Constructor Detail

StateDiagramGraphModel

public StateDiagramGraphModel()
Method Detail

getNamespace

public MNamespace getNamespace()

setNamespace

public void setNamespace(MNamespace m)

getMachine

public MStateMachine getMachine()

setMachine

public void setMachine(MStateMachine sm)

getPorts

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


getOwner

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


getInEdges

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


getOutEdges

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


getSourcePort

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


getDestPort

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


canAddNode

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


canAddEdge

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


addNode

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


addEdge

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


addNodeRelatedEdges

public void addNodeRelatedEdges(java.lang.Object node)

canConnect

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

Overrides:
canConnect in class UMLMutableGraphSupport

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

Overrides:
connect in class UMLMutableGraphSupport
Parameters:
fromPort - The originating port to connect
toPort - The destination port to connect
edgeClass - The NSUML type of edge to create.
Returns:
The type of edge created (the same as edgeClass if we succeeded, null otherwise)

vetoableChange

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

canChangeConnectedNode

public boolean canChangeConnectedNode(java.lang.Object newNode,
                                      java.lang.Object oldNode,
                                      java.lang.Object edge)
Parameters:
newNode - this is the new node that one of the ends is dragged to.
oldNode - this is the existing node that is already connected.
edge - this is the edge that is being dragged/rerouted
Returns:
true if a transition is being rerouted between two states.

changeConnectedNode

public void changeConnectedNode(java.lang.Object newNode,
                                java.lang.Object oldNode,
                                java.lang.Object edge,
                                boolean isSource)
Reroutes the connection to the old node to be connected to the new node.

Parameters:
newNode - this is the new node that one of the ends is dragged to.
oldNode - this is the existing node that is already connected.
edge - this is the edge that is being dragged/rerouted
isSource - tells us which end is being rerouted.


ArgoUML © 1996-2003 (20040229)ArgoUML Project HomeArgoUML Cookbook