org.argouml.uml.diagram.ui
Class UMLDiagram

java.lang.Object
  |
  +--Diagram
        |
        +--org.argouml.ui.ArgoDiagram
              |
              +--org.argouml.uml.diagram.ui.UMLDiagram
Direct Known Subclasses:
UMLActivityDiagram, UMLClassDiagram, UMLCollaborationDiagram, UMLDeploymentDiagram, UMLSequenceDiagram, UMLStateDiagram, UMLUseCaseDiagram

public abstract class UMLDiagram
extends ArgoDiagram

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.

See Also:
Serialized Form

Field Summary
protected static javax.swing.Action _actionBroom
           
protected static javax.swing.Action _actionCircle
           
protected static javax.swing.Action _actionInk
           
protected static javax.swing.Action _actionLine
           
protected static javax.swing.Action _actionPoly
           
protected static javax.swing.Action _actionRectangle
           
protected static javax.swing.Action _actionRRectangle
           
protected static javax.swing.Action _actionSelect
           
protected static javax.swing.Action _actionSpline
           
protected static javax.swing.Action _actionText
           
protected  DiagramInfo _diagramName
           
protected  MNamespace _namespace
           
protected static Category cat
           
 
Fields inherited from class org.argouml.ui.ArgoDiagram
TheInstance
 
Constructor Summary
UMLDiagram()
           
UMLDiagram(MNamespace ns)
           
UMLDiagram(java.lang.String diagramName, MNamespace ns)
           
 
Method Summary
 java.lang.Object[] getActions()
          Return actions available for building toolbar or similar.
 java.lang.String getClassAndModelID()
           
 MNamespace getNamespace()
           
 MModelElement getOwner()
           
 ToolBar getToolBar()
          Get the toolbar for the diagram
protected abstract  java.lang.Object[] getUmlActions()
          Implement on the ancestor to get actions to populate toolbar.
 void initialize(java.lang.Object owner)
           
 void initToolBar()
          This is a template method.
 void listRoleItemSet(MElementEvent e)
          not used the UMLDiagram is only interested in the removed() event.
 void propertySet(MElementEvent e)
          not used the UMLDiagram is only interested in the removed() event.
 void recovered(MElementEvent e)
          not used the UMLDiagram is only interested in the removed() event.
 void removeAsTarget()
          Removes the UMLDiagram and all the figs on it as listener to UmlModelEventPump.
 void removed(MElementEvent e)
          This diagram listens to events from is namespace ModelElement; When the modelelement is removed, we also want to delete this diagram too.
 void roleAdded(MElementEvent e)
          not used the UMLDiagram is only interested in the removed() event.
 void roleRemoved(MElementEvent e)
          not used the UMLDiagram is only interested in the removed() event.
 void setAsTarget()
          Adds the UMLDiagram and all the figs on it as listener to UmlModelEventPump.
 void setName(java.lang.String n)
           
 void setNamespace(java.lang.Object ns)
          sets the namespace of the Diagram, and adds the diagram as a listener of its namspace in the UML model.
 
Methods inherited from class org.argouml.ui.ArgoDiagram
addChangeRegistryAsListener, damage, getContainingFig, getEdges, getItemUID, getNodes, getVetoMessage, removeChangeRegistryAsListener, setItemUID
 
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

_actionSelect

protected static javax.swing.Action _actionSelect

_actionBroom

protected static javax.swing.Action _actionBroom

_actionRectangle

protected static javax.swing.Action _actionRectangle

_actionRRectangle

protected static javax.swing.Action _actionRRectangle

_actionCircle

protected static javax.swing.Action _actionCircle

_actionLine

protected static javax.swing.Action _actionLine

_actionText

protected static javax.swing.Action _actionText

_actionPoly

protected static javax.swing.Action _actionPoly

_actionSpline

protected static javax.swing.Action _actionSpline

_actionInk

protected static javax.swing.Action _actionInk

_namespace

protected MNamespace _namespace

_diagramName

protected DiagramInfo _diagramName
Constructor Detail

UMLDiagram

public UMLDiagram()

UMLDiagram

public UMLDiagram(MNamespace ns)

UMLDiagram

public UMLDiagram(java.lang.String diagramName,
                  MNamespace ns)
Method Detail

initialize

public void initialize(java.lang.Object owner)
Overrides:
initialize in class ArgoDiagram
See Also:
org.tigris.gef.base.Diagram#initialize(Object)

getNamespace

public MNamespace getNamespace()

setNamespace

public void setNamespace(java.lang.Object ns)
sets the namespace of the Diagram, and adds the diagram as a listener of its namspace in the UML model. (so that it can delete itself when the model element is deleted).


getClassAndModelID

public java.lang.String getClassAndModelID()

getOwner

public MModelElement getOwner()

setName

public void setName(java.lang.String n)
             throws java.beans.PropertyVetoException
Overrides:
setName in class ArgoDiagram
java.beans.PropertyVetoException

getToolBar

public ToolBar getToolBar()
Get the toolbar for the diagram

Returns:
the diagram toolbar

initToolBar

public void initToolBar()
This is a template method. It sets up the standard toolbar buttons required for all diagram toolbars calling the abstract method initToolBar(JToolBar) which should be implemented on the ancestor to populate the toolbar with diagram specific buttons.

See Also:
org.tigris.gef.base.Diagram#initToolBar()

getActions

public java.lang.Object[] getActions()
Return actions available for building toolbar or similar.

Returns:
an array of available actions.

getUmlActions

protected abstract java.lang.Object[] getUmlActions()
Implement on the ancestor to get actions to populate toolbar.


removed

public void removed(MElementEvent e)
This diagram listens to events from is namespace ModelElement; When the modelelement is removed, we also want to delete this diagram too.

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.


propertySet

public void propertySet(MElementEvent e)
not used the UMLDiagram is only interested in the removed() event.


roleAdded

public void roleAdded(MElementEvent e)
not used the UMLDiagram is only interested in the removed() event.


roleRemoved

public void roleRemoved(MElementEvent e)
not used the UMLDiagram is only interested in the removed() event.


listRoleItemSet

public void listRoleItemSet(MElementEvent e)
not used the UMLDiagram is only interested in the removed() event.


recovered

public void recovered(MElementEvent e)
not used the UMLDiagram is only interested in the removed() event.


removeAsTarget

public void removeAsTarget()
Removes the UMLDiagram and all the figs on it as listener to UmlModelEventPump. Is called by setTarget in TabDiagram to improve performance.


setAsTarget

public void setAsTarget()
Adds the UMLDiagram and all the figs on it as listener to UmlModelEventPump. Together with removeAsModelListener this is a performance improvement.



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