org.argouml.uml.diagram.state
Class StateDiagramGraphModel

java.lang.Object
  extended byorg.tigris.gef.graph.MutableGraphSupport
      extended byorg.argouml.uml.diagram.UMLMutableGraphSupport
          extended byorg.argouml.uml.diagram.state.StateDiagramGraphModel
All Implemented Interfaces:
org.tigris.gef.graph.BaseGraphModel, EventListener, org.tigris.gef.graph.GraphModel, org.tigris.gef.graph.MutableGraphModel, Serializable, VetoableChangeListener
Direct Known Subclasses:
ActivityDiagramGraphModel

public class StateDiagramGraphModel
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 MState Digrams.

See Also:
Serialized Form

Field Summary
private static Logger LOG
          Logger.
private  Object machine
          The statemachine we are diagramming.
private  Object 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".
(package private) static long serialVersionUID
           
 
Fields inherited from class org.argouml.uml.diagram.UMLMutableGraphSupport
 
Fields inherited from class org.tigris.gef.graph.MutableGraphSupport
 
Constructor Summary
StateDiagramGraphModel()
           
 
Method Summary
 void addEdge(Object edge)
          Add the given edge to the graph, if valid.
 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 canChangeConnectedNode(Object newNode, Object oldNode, Object edge)
           
 boolean canConnect(Object fromPort, 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(Object newNode, Object oldNode, Object edge, boolean isSource)
          Reroutes the connection to the old node to be connected to the new node.
 Object connect(Object fromPort, Object toPort, Class edgeClass)
          Contruct and add a new edge of the given kind.
 List getInEdges(Object port)
          Return all edges going to given port.
 Object getMachine()
           
 Object getNamespace()
           
 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 setMachine(Object sm)
           
 void setNamespace(Object ns)
           
 void vetoableChange(PropertyChangeEvent pce)
           
 
Methods inherited from class org.argouml.uml.diagram.UMLMutableGraphSupport
buildCommentConnection, buildConnection, connect, constainsEdge, containsNode, getDestPort, getEdges, getNodes, getSourcePort, isConnectionValid, removeEdge, removeNode
 
Methods inherited from class org.tigris.gef.graph.MutableGraphSupport
addGraphEventListener, canConnect, canDragNode, 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.


namespace

private Object 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

private Object machine
The statemachine we are diagramming.


serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

StateDiagramGraphModel

public StateDiagramGraphModel()
Method Detail

getNamespace

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

setNamespace

public void setNamespace(Object ns)
Parameters:
ns - the namespace

getMachine

public Object getMachine()
Returns:
the statemachine of this diagram

setMachine

public void setMachine(Object sm)
Parameters:
sm - the statemachine of this diagram

getPorts

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

Specified by:
getPorts in interface org.tigris.gef.graph.GraphModel
Parameters:
nodeOrEdge - The node or the edge.
Returns:
The ports.

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
Parameters:
port - the port
Returns:
The owner of the port.
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)
Add the given edge to the graph, if valid.

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 fromPort,
                          Object toPort)
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 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 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)
See Also:
MutableGraphModel.connect(java.lang.Object, java.lang.Object, java.lang.Class)

vetoableChange

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

canChangeConnectedNode

public boolean canChangeConnectedNode(Object newNode,
                                      Object oldNode,
                                      Object edge)
Specified by:
canChangeConnectedNode in interface org.tigris.gef.graph.MutableGraphModel
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(Object newNode,
                                Object oldNode,
                                Object edge,
                                boolean isSource)
Reroutes the connection to the old node to be connected to the new node.

Specified by:
changeConnectedNode in interface org.tigris.gef.graph.MutableGraphModel
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-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook