|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.tigris.gef.graph.MutableGraphSupport | +--org.argouml.uml.diagram.UMLMutableGraphSupport | +--org.argouml.uml.diagram.use_case.UseCaseDiagramGraphModel
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 Use Case Diagrams.
Field Summary | |
protected ru.novosoft.uml.foundation.core.MNamespace |
_model
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 org.apache.log4j.Category |
cat
|
Fields inherited from class org.argouml.uml.diagram.UMLMutableGraphSupport |
_edges, _nodes |
Fields inherited from class org.tigris.gef.graph.MutableGraphSupport |
_graphListeners |
Constructor Summary | |
UseCaseDiagramGraphModel()
|
Method Summary | |
void |
addEdge(java.lang.Object edge)
Add the given edge to the graph, if valid. We add the edge if it is not already on the graph, and (assuming it to be an association, generalization, extend, include or dependency) add it to the owned elements for the model. Needs more work. |
void |
addNode(java.lang.Object node)
Add the given node to the graph, if valid. We add the node if it is not already on the graph, and (assuming it to be an actor or use case) add it to the owned elements for the model. Needs more work. |
void |
addNodeRelatedEdges(java.lang.Object node)
Add the various types of edge that may be connected with the given node. For use cases we may find extend and include relationships. |
boolean |
canAddEdge(java.lang.Object edge)
Determine if the given edge can validly be placed on this graph. We cannot do so if the edge is already on the graph (unlike nodes they may not appear more than once). Otherwise, for all valid types of edge (binary association, generalization, extend, include, dependency) we get the two ends. |
boolean |
canAddNode(java.lang.Object node)
Determine if the given node can validly be placed on this graph. This is simply a matter of determining if the node is an actor or use case. Note. |
boolean |
canConnect(java.lang.Object fromP,
java.lang.Object toP)
Determine if the two given ports can be connected by a kind of edge to be determined by the ports. Note. |
java.lang.Object |
connect(java.lang.Object fromPort,
java.lang.Object toPort)
Deprecated. We don't try to work out the type of edge ourself. Use connect(Object, Object, java.lang.Class) instead.
This method will just print a rude message and do nothing. |
java.lang.Object |
connect(java.lang.Object fromPort,
java.lang.Object toPort,
java.lang.Class edgeClass)
Construct and add a new edge of the given kind. We use the MMUtil utilities to create the NSUML object of the type desired. Note. |
java.lang.Object |
getDestPort(java.lang.Object edge)
Return the destination end of an edge. Needs more work. |
java.util.Vector |
getInEdges(java.lang.Object port)
Return all edges going to given port. The only objects with ports on the use case diagram are actors and use cases. |
ru.novosoft.uml.foundation.core.MNamespace |
getNamespace()
Accessor to get the namespace. |
java.util.Vector |
getOutEdges(java.lang.Object port)
Return all edges going from the given port. Needs more work. |
java.lang.Object |
getOwner(java.lang.Object port)
|
java.util.Vector |
getPorts(java.lang.Object nodeOrEdge)
Return all ports on a node or edge supplied as argument. The only objects on our diagram that have any ports are use cases and actors, and they each have one - themself. |
java.lang.Object |
getSourcePort(java.lang.Object edge)
Return the source end of an edge. Needs more work. |
void |
setNamespace(ru.novosoft.uml.foundation.core.MNamespace m)
Accessor to set the namespace. Clears the current listener if we have a namespace at present. |
void |
vetoableChange(java.beans.PropertyChangeEvent pce)
Called when a property of interest has been changed - in this case the owned elements of the model. |
Methods inherited from class org.argouml.uml.diagram.UMLMutableGraphSupport |
constainsEdge, containsNode, getEdges, getNodes, removeEdge, removeNode |
Methods inherited from class org.tigris.gef.graph.MutableGraphSupport |
addGraphEventListener, canChangeConnectedNode, canConnect, canDragNode, changeConnectedNode, containsEdge, containsEdgePort, 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 |
Field Detail |
protected static org.apache.log4j.Category cat
protected ru.novosoft.uml.foundation.core.MNamespace _model
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.
Constructor Detail |
public UseCaseDiagramGraphModel()
Method Detail |
public ru.novosoft.uml.foundation.core.MNamespace getNamespace()
Accessor to get the namespace.
public void setNamespace(ru.novosoft.uml.foundation.core.MNamespace m)
Accessor to set the namespace.
Clears the current listener if we have a namespace at present. Sets a new listener if we set a new namespace (i.e. m is non-null).
m
- The namespace to use for this graph modelpublic java.util.Vector getPorts(java.lang.Object nodeOrEdge)
Return all ports on a node or edge supplied as argument.
The only objects on our diagram that have any ports are use cases and actors, and they each have one - themself.
nodeOrEdge
- A model element, for whom the list of ports is
wanted.public java.lang.Object getOwner(java.lang.Object port)
public java.util.Vector getInEdges(java.lang.Object port)
Return all edges going to given port.
The only objects with ports on the use case diagram are actors and use cases. In each case we find the attached association ends, and build a list of them as the incoming ports.
port
- The port for which we want to know the incoming edges.public java.util.Vector getOutEdges(java.lang.Object port)
Return all edges going from the given port.
Needs more work. This would seem superficially to be
identical to getInEdges(java.lang.Object)
, but in our implementation we return
an empty vector.
port
- The port for which we want to know the outgoing edges.public java.lang.Object getSourcePort(java.lang.Object edge)
Return the source end of an edge.
Needs more work. In the current implementation we only know how to handle associations, returning the first of its connections—which, if set, will be a use case or an actor.
edge
- The edge for which we want the source port.null
if the
edge given is not an association or has no source defined.public java.lang.Object getDestPort(java.lang.Object edge)
Return the destination end of an edge.
Needs more work. In the current implementation we only know how to handle associations, returning the second of its connections—which, if set, will be a use case or an actor.
edge
- The edge for which we want the destination port.null
if
the edge given is not an association or has no destination
defined.public boolean canAddNode(java.lang.Object node)
Determine if the given node can validly be placed on this graph.
This is simply a matter of determining if the node is an actor or use case.
Note. This is inconsistent with addNode(java.lang.Object)
, which will
not allow a node to be added to the graph if it is already there.
node
- The node to be consideredtrue
if the given object is a valid node in
this graph, false
otherwise.public boolean canAddEdge(java.lang.Object edge)
Determine if the given edge can validly be placed on this graph.
We cannot do so if the edge is already on the graph (unlike nodes they may not appear more than once).
Otherwise, for all valid types of edge (binary association, generalization, extend, include, dependency) we get the two ends. If they are both nodes already on the graph we are OK, otherwise we cannot place the edge on the graph.
edge
- The edge to be consideredtrue
if the given object is a valid edge in
this graph, false
otherwise.public void addNode(java.lang.Object node)
Add the given node to the graph, if valid.
We add the node if it is not already on the graph, and (assuming it to be an actor or use case) add it to the owned elements for the model.
Needs more work. In adding the node to the owned elements of the model namespace, we are implicitly making it public visibility (it could be private to this namespace).
Note. This method is inconsistent with canAddNode(java.lang.Object)
,
which will allow a node to be added to the graph if it is already
there.
node
- The node to be added to the graph.public void addEdge(java.lang.Object edge)
Add the given edge to the graph, if valid.
We add the edge if it is not already on the graph, and (assuming it to be an association, generalization, extend, include or dependency) add it to the owned elements for the model.
Needs more work. In adding the edge to the owned elements of the model namespace, we are implicitly making it public visibility (it could be private to this namespace).
edge
- The edge to be added to the graph.public void addNodeRelatedEdges(java.lang.Object node)
Add the various types of edge that may be connected with the given node.
For use cases we may find extend and include relationships. For classifiers (effectively actors and use cases) we may find associations. For generalizable elements (effectively actors and use cases again) we may find generalizations and specializations. For ModelElements (effectively actors and use cases again) we may find dependencies.
node
- The node whose edges are to be added.public boolean canConnect(java.lang.Object fromP, java.lang.Object toP)
Determine if the two given ports can be connected by a kind of edge to be determined by the ports.
Note. There appears to be a problem with the implementation, since it suggests actors cannot connect. In fact generalization is permitted, and this works, suggesting this method is not actually invoked in the current implementation of ArgoUML.
fromP
- The source port of the connectiontoP
- The destination port of the connection.true
if the two given ports can be connected
by a kind of edge to be determined by the
ports. false
otherwise.public java.lang.Object connect(java.lang.Object fromPort, java.lang.Object toPort)
connect(Object, Object, java.lang.Class)
instead.
This method will just print a rude message and do nothing.
Construct and add a new edge of a kind determined by the ports.
fromPort
- The originating port to connecttoPort
- The destination port to connectpublic java.lang.Object connect(java.lang.Object fromPort, java.lang.Object toPort, java.lang.Class edgeClass)
Construct and add a new edge of the given kind.
We use the MMUtil utilities to create the NSUML object of the type desired.
Note. The MMUtil utitilities often do not set up default attribute values for NSUML objects created.
connect
in class org.tigris.gef.graph.MutableGraphSupport
fromPort
- The originating port to connecttoPort
- The destination port to connectedgeClass
- The NSUML type of edge to create.edgeClass
if we succeeded,
null
otherwise)public void vetoableChange(java.beans.PropertyChangeEvent pce)
Called when a property of interest has been changed - in this case
the owned elements of the model. Provided to implement the VetoableChangeListener
interface.
We could throw a PropertyVetoException
if we wished to allow
the change to be rolled back, but we don't.
vetoableChange
in interface java.beans.VetoableChangeListener
pce
- The event that triggered us, and from which we can extract
the name of the property that triggered us.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML (c) 1996-2002 |