|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.tigris.gef.base.Diagram
org.argouml.ui.ArgoDiagram
org.argouml.uml.diagram.ui.UMLDiagram
This class provides support for writing a UML diagram for argo using the GEF framework.
It adds common buttons, a namespace, capability to delete itself when its namespace is deleted, some help with creating a valid diagram name.
There are various methods for returning 'structures' of Actions which are used to build toolbars and dropdown buttons within toolbars. These structures are arrays of Objects. An array element is actually either an Action, null or another array. When building a toolbar an Action is used to create a button and null is used to create a spacer in the toolbar. An element containing an array results in a dropdown toolbar button being created which contains all the items in that array.
The "owner" of the UMLDiagram needs to be set to the one and only UML modelelement of which the diagram depends. E.g. for a class diagram is that its namespace, and for a collaboration diagram is that the Collaboration UML object. Override the getOwner method to return the owner.
TODO: MVW: I am not sure of the following:
The "namespace" of the diagram is e.g. used when creating new elements
that are shown on the diagram; they will have their namespace set
according this. It is NOT necessarily equal to the "owner".
MVW: I am sure about the following:
The "namespace" of the diagram is e.g. used to register a listener
to the UML model, to be notified if this element is removed;
which will imply that this diagram has to be deleted, too.
Hence the namespace of e.g. a collaboration diagram should be the
represented classifier or, in case of a represented operation, its owner.
Field Summary | |
private static Action |
actionBroom
|
private static Action |
actionCircle
|
private static Action |
actionComment
Tool to add a comment node. |
private static Action |
actionCommentLink
Tool to create an relationship between a comment node and some other node using a polyedge. |
private static Action |
actionInk
|
private static Action |
actionLine
|
private static Action |
actionPoly
|
private static Action |
actionRectangle
|
private static Action |
actionRRectangle
|
private static Action |
actionSelect
|
private static Action |
actionSpline
|
private static Action |
actionText
|
private int |
diagramSerial
The serial number for new diagrams. |
private static Logger |
LOG
|
private Object |
namespace
|
(package private) static long |
serialVersionUID
|
private JToolBar |
toolBar
|
Fields inherited from class org.argouml.ui.ArgoDiagram |
|
Fields inherited from class org.tigris.gef.base.Diagram |
_comments, _name, _toolBar, NAME_KEY, SCALE_KEY |
Constructor Summary | |
UMLDiagram()
The constructor. |
|
UMLDiagram(Object ns)
|
|
UMLDiagram(String name,
Object ns)
|
Method Summary | |
void |
deselectAllTools()
Set all toolbar buttons to unselected other then the toolbar button with the supplied action. |
void |
deselectOtherTools(Action otherThanAction)
Set all toolbar buttons to unselected other then the toolbar button with the supplied action. |
Object[] |
getActions()
Return actions available for building toolbar or similar. |
String |
getClassAndModelID()
|
private Object[] |
getCommentActions()
Get a 'structure' of actions for appending the comment tools to the toolbar. |
JToolBar |
getJToolBar()
Get the toolbar for the diagram. |
abstract String |
getLabelName()
|
private Object[] |
getManipulateActions()
Get a 'structure' of actions for appending the manipulation mode tools to the toolbar. |
Object |
getNamespace()
|
protected int |
getNextDiagramSerial()
|
Object |
getOwner()
The default implementation for diagrams that have the namespace as their owner. |
private Object[] |
getShapeActions()
Get a 'structure' of actions for appending primitive drawing tools to the toolbar. |
private Object[] |
getShapePopupActions()
Get a 'structure' of actions for showing in the shape primitives popup tool button. |
protected abstract Object[] |
getUmlActions()
Implement in the ancestor to get a 'structure' of actions for appending the UML creation tools to the toolbar. |
void |
initialize(Object owner)
|
void |
initToolBar()
Create the toolbar based on actions for the specific diagram subclass. |
protected Action |
makeCreateAssociationAction(Object aggregationKind,
boolean unidirectional,
String descr)
Factory method to build an Action for creating an association edge in the diagram. |
protected Action |
makeCreateEdgeAction(Object modelElement,
String descr)
Factory method to build an Action for creating an edge in the diagram. |
protected Action |
makeCreateNodeAction(Object modelElement,
String descr)
Factory method to build an Action for creating a node in the diagram. |
boolean |
needsToBeRemoved()
This method shall indicate if the diagram needs to be removed because the modelelements on which it depends are removed. |
void |
propertyChange(PropertyChangeEvent evt)
This diagram listens to events from its namespace ModelElement; when the modelelement is removed, we also want to delete this diagram. |
void |
removeAsTarget()
Removes the UMLDiagram and all the figs on it as listener to UML Events. |
void |
resetDiagramSerial()
Reset the diagram serial counter to the initial value. |
void |
setAsTarget()
Adds the UMLDiagram and all the figs on it as listener to UML Events. |
void |
setNamespace(Object ns)
Sets the namespace of the Diagram, and adds the diagram as a listener of its namespace in the UML model (so that it can delete itself when the model element is deleted). |
Methods inherited from class org.argouml.ui.ArgoDiagram |
damage, getContainingFig, getEdges, getItemUID, getNodes, getVetoMessage, setItemUID, setName, toString |
Methods inherited from class org.tigris.gef.base.Diagram |
add, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, bringForward, bringToFront, countContained, edgeAdded, edgeRemoved, elements, elementsIn, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getComments, getGraphController, getGraphModel, getLayer, getName, getScale, getShowSingleMultiplicity, getToolBar, graphChanged, hit, nodeAdded, nodeRemoved, postLoad, postSave, preSave, presentationFor, remove, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, reorder, sendBackward, sendToBack, setComments, setGraphModel, setLayer, setScale, setShowSingleMultiplicity, setToolBar |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final Logger LOG
private int diagramSerial
private static Action actionComment
private static Action actionCommentLink
private static Action actionSelect
private static Action actionBroom
private static Action actionRectangle
private static Action actionRRectangle
private static Action actionCircle
private static Action actionLine
private static Action actionText
private static Action actionPoly
private static Action actionSpline
private static Action actionInk
private Object namespace
private JToolBar toolBar
static final long serialVersionUID
Constructor Detail |
public UMLDiagram()
public UMLDiagram(Object ns)
ns
- the UML namespace of this diagrampublic UMLDiagram(String name, Object ns)
name
- the name of the diagramns
- the UML namespace of this diagramMethod Detail |
public void initialize(Object owner)
initialize
in class ArgoDiagram
Diagram.initialize(java.lang.Object)
public Object getNamespace()
public void setNamespace(Object ns)
ns
- the namespace for the diagrampublic String getClassAndModelID()
Diagram.getClassAndModelID()
public Object getOwner()
public JToolBar getJToolBar()
public void initToolBar()
Diagram.initToolBar()
public Object[] getActions()
protected abstract Object[] getUmlActions()
private Object[] getManipulateActions()
private Object[] getCommentActions()
private Object[] getShapeActions()
private Object[] getShapePopupActions()
public void propertyChange(PropertyChangeEvent evt)
There is also a risk that if this diagram was the one shown in the diagram panel, then it will remain after it has been deleted. So we need to deselect this diagram.
propertyChange
in interface PropertyChangeListener
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
public void removeAsTarget()
public void setAsTarget()
public void deselectOtherTools(Action otherThanAction)
otherThanAction
- the action of the button
that is NOT to be deselectedpublic void deselectAllTools()
protected Action makeCreateNodeAction(Object modelElement, String descr)
modelElement
- identifies the model element type to makedescr
- the description to give this action.
protected Action makeCreateEdgeAction(Object modelElement, String descr)
modelElement
- identifies the model element type to makedescr
- the description to give this action.
protected Action makeCreateAssociationAction(Object aggregationKind, boolean unidirectional, String descr)
aggregationKind
- the type of aggregation for this associationunidirectional
- true if this is a one way association.descr
- the description to give this action.
public void resetDiagramSerial()
protected int getNextDiagramSerial()
public abstract String getLabelName()
public boolean needsToBeRemoved()
Matters get more complicated for e.g. a Statechart Diagram, which also depends on its context (the represented modelelement). Hence such a diagram needs to override this method.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20050222) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |