org.argouml.uml.diagram.ui
Class UMLDiagram

java.lang.Object
  extended byorg.tigris.gef.base.Diagram
      extended byorg.argouml.ui.ArgoDiagram
          extended byorg.argouml.uml.diagram.ui.UMLDiagram
All Implemented Interfaces:
java.util.EventListener, org.tigris.gef.graph.GraphListener, ru.novosoft.uml.MElementListener, java.io.Serializable
Direct Known Subclasses:
UMLActivityDiagram, UMLClassDiagram, UMLCollaborationDiagram, UMLDeploymentDiagram, UMLSequenceDiagram, UMLStateDiagram, UMLUseCaseDiagram

public abstract class UMLDiagram
extends ArgoDiagram
implements ru.novosoft.uml.MElementListener

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  java.lang.Object _namespace
           
protected static org.apache.log4j.Logger cat
           
(package private) static long serialVersionUID
           
private  javax.swing.JToolBar toolBar
           
 
Fields inherited from class org.argouml.ui.ArgoDiagram
TheInstance
 
Fields inherited from class org.tigris.gef.base.Diagram
_comments, _name, _toolBar, NAME_KEY, SCALE_KEY
 
Constructor Summary
UMLDiagram()
           
UMLDiagram(java.lang.Object ns)
           
UMLDiagram(java.lang.String diagramName, java.lang.Object ns)
           
 
Method Summary
 void deselectAllTools()
          Set all toolbar buttons to unselected other then the toolbar button with the supplied action.
 void deselectOtherTools(javax.swing.Action otherThanAction)
          Set all toolbar buttons to unselected other then the toolbar button with the supplied action.
 java.lang.Object[] getActions()
          Return actions available for building toolbar or similar.
 java.lang.String getClassAndModelID()
           
 javax.swing.JToolBar getJToolBar()
          Get the toolbar for the diagram
private  java.lang.Object[] getManipulateActions()
           
 java.lang.Object getNamespace()
           
 java.lang.Object getOwner()
           
private  java.lang.Object[] getShapeActions()
           
private  java.lang.Object[] getShapePopupActions()
           
protected abstract  java.lang.Object[] getUmlActions()
          Implement on the ancestor to get actions to populate toolbar.
 void initialize(java.lang.Object owner)
           
 void initToolBar()
          Create the toolbar based on actions for the spcific diagram subclass.
 void listRoleItemSet(ru.novosoft.uml.MElementEvent e)
          not used the UMLDiagram is only interested in the removed() event.
 void propertySet(ru.novosoft.uml.MElementEvent e)
          not used the UMLDiagram is only interested in the removed() event.
 void recovered(ru.novosoft.uml.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(ru.novosoft.uml.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(ru.novosoft.uml.MElementEvent e)
          not used the UMLDiagram is only interested in the removed() event.
 void roleRemoved(ru.novosoft.uml.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, getNodes, getVetoMessage, removeChangeRegistryAsListener, setItemUID, 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

cat

protected static org.apache.log4j.Logger 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 java.lang.Object _namespace

_diagramName

protected DiagramInfo _diagramName

toolBar

private javax.swing.JToolBar toolBar

serialVersionUID

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

UMLDiagram

public UMLDiagram()

UMLDiagram

public UMLDiagram(java.lang.Object ns)

UMLDiagram

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

initialize

public void initialize(java.lang.Object owner)
Overrides:
initialize in class ArgoDiagram
See Also:
Diagram.initialize(Object)

getNamespace

public java.lang.Object 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 java.lang.Object getOwner()

setName

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

getJToolBar

public javax.swing.JToolBar getJToolBar()
Get the toolbar for the diagram

Returns:
the diagram toolbar

initToolBar

public void initToolBar()
Create the toolbar based on actions for the spcific diagram subclass.

See Also:
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.


getManipulateActions

private java.lang.Object[] getManipulateActions()

getShapeActions

private java.lang.Object[] getShapeActions()

getShapePopupActions

private java.lang.Object[] getShapePopupActions()

removed

public void removed(ru.novosoft.uml.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.

Specified by:
removed in interface ru.novosoft.uml.MElementListener

propertySet

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

Specified by:
propertySet in interface ru.novosoft.uml.MElementListener

roleAdded

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

Specified by:
roleAdded in interface ru.novosoft.uml.MElementListener

roleRemoved

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

Specified by:
roleRemoved in interface ru.novosoft.uml.MElementListener

listRoleItemSet

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

Specified by:
listRoleItemSet in interface ru.novosoft.uml.MElementListener

recovered

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

Specified by:
recovered in interface ru.novosoft.uml.MElementListener

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.


deselectOtherTools

public void deselectOtherTools(javax.swing.Action otherThanAction)
Set all toolbar buttons to unselected other then the toolbar button with the supplied action.


deselectAllTools

public void deselectAllTools()
Set all toolbar buttons to unselected other then the toolbar button with the supplied action.



ArgoUML © 1996-2004 (20040316)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook