org.argouml.uml.diagram.ui
Class FigAssociation

java.lang.Object
  extended byorg.tigris.gef.presentation.Fig
      extended byorg.tigris.gef.presentation.FigEdge
          extended byorg.tigris.gef.presentation.FigEdgePoly
              extended byorg.argouml.uml.diagram.ui.FigEdgeModelElement
                  extended byorg.argouml.uml.diagram.ui.FigAssociation
All Implemented Interfaces:
ArgoEventListener, ArgoNotationEventListener, Cloneable, Connecter, DelayedVChangeListener, EventListener, org.tigris.gef.di.GraphEdge, org.tigris.gef.di.GraphicElement, Highlightable, KeyListener, MouseListener, NotationContext, PopupGenerator, PropertyChangeListener, Serializable, VetoableChangeListener
Direct Known Subclasses:
FigAssociationClass, FigAssociationRole

public class FigAssociation
extends FigEdgeModelElement

This class represents the Fig of a binary association on a diagram.

See Also:
Serialized Form

Field Summary
protected  NotationProvider4 notationProviderDestRole
           
protected  NotationProvider4 notationProviderSrcRole
           
 
Fields inherited from class org.argouml.uml.diagram.ui.FigEdgeModelElement
notationProviderName
 
Fields inherited from class org.tigris.gef.presentation.FigEdgePoly
_initiallyLaidOut
 
Fields inherited from class org.tigris.gef.presentation.FigEdge
_arrowHeadEnd, _arrowHeadStart, _destFigNode, _highlight, _pathItems, _sourceFigNode, _useNearest
 
Fields inherited from class org.tigris.gef.presentation.Fig
_allowsSaving, _context, _dashes, _dashPeriod, _dashStyle, _filled, _h, _w, _x, _y, an, annotationOwner, annotationStatus, BORDER, MIN_SIZE, plotter
 
Constructor Summary
FigAssociation()
          Main constructor Don't call this constructor directly.
FigAssociation(Object edge, Layer lay)
          Constructor that hooks the Fig to an existing UML element.
 
Method Summary
protected  FigTextGroup getMiddleGroup()
           
 Vector getPopUpActions(MouseEvent me)
           
protected  void initNotationProviders(Object own)
          Create the NotationProviders.
protected  void layoutEdge()
          Lays out the association edges as any other edge except for special rules for an association that loops back to the same class.
protected  void modelChanged(PropertyChangeEvent e)
          This is called after any part of the UML ModelElement has changed.
 void paint(Graphics g)
           
 void paintClarifiers(Graphics g)
           
 void propertyChange(PropertyChangeEvent e)
           
protected  void renderingChanged()
          Rerenders the fig if needed.
protected  void textEdited(FigText ft)
          This method is called after the user finishes editing a text field that is in the FigEdgeModelElement.
protected  void textEditStarted(FigText ft)
          This method is called when the user doubleclicked on the text field, and starts editing.
protected  void updateAbstract()
          Updates the name if modelchanged receives an "isAbstract" event.
 void updateListeners(Object oldOwner, Object newOwner)
          Implementations of this method should register/unregister the fig for all (model)events.
 
Methods inherited from class org.argouml.uml.diagram.ui.FigEdgeModelElement
addElementListener, addElementListener, addElementListener, allowRemoveFromDiagram, canEdit, damage, delayedVetoableChange, deleteFromModel, getApplyStereotypeActions, getContextNotation, getDestination, getDiElement, getEdgePort, getItalicLabelFont, getItemUID, getLabelFont, getName, getNameBounds, getNameFig, getPopupAddOffset, getRemoveDelegate, getSource, getSquaredDistance, getStereotypeFig, getTipString, hit, hitClarifier, indicateBounds, keyPressed, keyReleased, keyTyped, makeEdgePort, makeSelection, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, notationAdded, notationChanged, notationProviderAdded, notationProviderRemoved, notationRemoved, postLoad, removeAllElementListeners, removeElementListener, removeFromDiagram, removeFromDiagramImpl, setContextNotation, setDiElement, setItemUID, setLayer, setOwner, showHelp, superRemoveFromDiagram, updateClassifiers, updateNameText, updateStereotypeText, vetoableChange
 
Methods inherited from class org.tigris.gef.presentation.FigEdgePoly
computeRouteImpl, findAvoidPt, getPolygon, insertPoint, makeEdgeFig, moveVertex, paint, routingRectPoint, segOK, setEndPoints, setInitiallyLaidOut, setPoint, setPolygon, tryRoute
 
Methods inherited from class org.tigris.gef.presentation.FigEdge
addPathItem, calcBounds, cleanUp, computeRoute, contains, getBetweenNearestPoints, getBounds, getDashed, getDestArrowHead, getDestFigNode, getDestPortFig, getFig, getFirstPoint, getHighlight, getLastPoint, getLineColor, getLineWidth, getNumPoints, getPathItem, getPathItemFig, getPathItemFigs, getPathItemsRaw, getPerimeterLength, getPoint, getPoints, getPrivateData, getSourceArrowHead, getSourceFigNode, getSourcePortFig, getXs, getYs, hasFillColor, hitFig, intersects, isReshapable, isResizable, isRotatable, paintArrowHeads, paintHighlightLine, paintPathItems, removePathItem, removePathItem, setBetweenNearestPoints, setDashed, setDestArrowHead, setDestFigNode, setDestPortFig, setFig, setHighlight, setLineColor, setLineWidth, setNumPoints, setPoint, setPoints, setSourceArrowHead, setSourceFigNode, setSourcePortFig, setXs, setYs, stuffPointAlongPerimeter, translateEdge, updatePathItemLocations
 
Methods inherited from class org.tigris.gef.presentation.Fig
addAnnotation, addPoint, addPropertyChangeListener, align, center, classNameAndBounds, clone, connectionPoint, contains, contains, countCornersContained, createDrag, endTrans, firePropChange, firePropChange, firePropChange, getAnnotationOwner, getAnnotationStrategy, getBounds, getCenter, getClosestPoint, getContext, getDashed01, getDashedString, getEnclosedFigs, getEnclosingFig, getFillColor, getFilled, getFilled01, getGravityPoints, getGroup, getHalfHeight, getHalfWidth, getHandleBox, getHeight, getId, getLayer, getLocation, getLocked, getMinimumSize, getOwner, getPreferredSize, getResource, getSingle, getSize, getTrapRect, getUseTrapRect, getVisState, getWidth, getX, getY, hasLineColor, initAnnotations, intersectsPerimeter, isAnnotation, isCopyable, isCutable, isLowerRightResizable, isMovable, isRemoveStarted, isSelectable, isSelected, isVisible, pointAlongPerimeter, postSave, preSave, print, redraw, removeAnnotation, removePoint, removePropertyChangeListener, reorder, routingRect, savingAllowed, setAnnotationOwner, setAnnotationStatus, setAnnotationStrategy, setBounds, setBounds, setBoundsImpl, setCenter, setContext, setDashedString, setEnclosingFig, setFillColor, setFilled, setGroup, setHandleBox, setHeight, setLocation, setLocation, setLocked, setMovable, setPoint, setPoint, setPrivateData, setResizable, setResource, setSavingAllowed, setSize, setSize, setVisible, setWidth, setX, setY, stuffBounds, translate, translateAnnotations, translateImpl, unsetAnnotationOwner, updateAnnotationPositions, within
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.argouml.cognitive.Highlightable
getHighlight, setHighlight
 
Methods inherited from interface org.tigris.gef.di.GraphicElement
getId, getOwner, routingRect
 

Field Detail

notationProviderSrcRole

protected NotationProvider4 notationProviderSrcRole

notationProviderDestRole

protected NotationProvider4 notationProviderDestRole
Constructor Detail

FigAssociation

public FigAssociation()
Main constructor Don't call this constructor directly. It is public since this is necessary for loading. Use the FigAssociation(Object, Layer) constructor instead!


FigAssociation

public FigAssociation(Object edge,
                      Layer lay)
Constructor that hooks the Fig to an existing UML element.

Parameters:
edge - the UMl element
lay - the layer
Method Detail

initNotationProviders

protected void initNotationProviders(Object own)
Description copied from class: FigEdgeModelElement
Create the NotationProviders.

Overrides:
initNotationProviders in class FigEdgeModelElement
Parameters:
own - the current owner
See Also:
FigNodeModelElement.initNotationProviders(java.lang.Object)

updateListeners

public void updateListeners(Object oldOwner,
                            Object newOwner)
Description copied from class: FigEdgeModelElement
Implementations of this method should register/unregister the fig for all (model)events. For FigEdgeModelElement only the fig itself is registered as listening to events fired by the owner itself. But for, for example, FigAssociation the fig must also register for events fired by the stereotypes of the owner.

This function is used in UMLDiagram, which removes all listeners to all Figs when a diagram is not displayed, and restore them when it becomes visible again.

In this case, it is not imperative that indeed ALL listeners are updated, as long as the ones removed get added again and vice versa.

Additionally, this function may be used by the modelChanged() function.

In this case, it IS imperative that all listeners get removed / added.

Overrides:
updateListeners in class FigEdgeModelElement
Parameters:
newOwner - the new owner for the listeners
See Also:
org.argouml.uml.diagram.ui.FigEdgeModelElement#updateListeners(java.lang.Object)

textEdited

protected void textEdited(FigText ft)
Description copied from class: FigEdgeModelElement
This method is called after the user finishes editing a text field that is in the FigEdgeModelElement. Determine which field and update the model. This class handles the name, subclasses should override to handle other text elements.

Overrides:
textEdited in class FigEdgeModelElement
Parameters:
ft - the text Fig that has been edited
See Also:
FigEdgeModelElement.textEdited(org.tigris.gef.presentation.FigText)

textEditStarted

protected void textEditStarted(FigText ft)
Description copied from class: FigEdgeModelElement
This method is called when the user doubleclicked on the text field, and starts editing. Subclasses should overrule this field to e.g. supply help to the user about the used format.

It is also possible to alter the text to be edited already here, e.g. by adding the stereotype in front of the name, but that seems not user-friendly.

Overrides:
textEditStarted in class FigEdgeModelElement
Parameters:
ft - the FigText that will be edited and contains the start-text
See Also:
FigEdgeModelElement.textEditStarted(org.tigris.gef.presentation.FigText)

propertyChange

public void propertyChange(PropertyChangeEvent e)
Specified by:
propertyChange in interface PropertyChangeListener
Overrides:
propertyChange in class FigEdgeModelElement
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

modelChanged

protected void modelChanged(PropertyChangeEvent e)
Description copied from class: FigEdgeModelElement
This is called after any part of the UML ModelElement has changed. This method automatically updates the name FigText. Subclasses should override and update other parts.

Overrides:
modelChanged in class FigEdgeModelElement
Parameters:
e - the event
See Also:
FigEdgeModelElement.modelChanged(java.beans.PropertyChangeEvent)

renderingChanged

protected void renderingChanged()
Description copied from class: FigEdgeModelElement
Rerenders the fig if needed. This functionality was originally the functionality of modelChanged but modelChanged takes the event now into account.

NOTE: If you override this method you probably also want to override the modelChanged() method TODO: Call this method something sensible. What it does rather than one example of when it is called. Its purpose seems to be to update everything if anything has changed. Not very efficient.

Overrides:
renderingChanged in class FigEdgeModelElement
See Also:
FigEdgeModelElement.renderingChanged()

getPopUpActions

public Vector getPopUpActions(MouseEvent me)
Specified by:
getPopUpActions in interface PopupGenerator
Overrides:
getPopUpActions in class FigEdgeModelElement
See Also:
PopupGenerator.getPopUpActions(java.awt.event.MouseEvent)

updateAbstract

protected void updateAbstract()
Updates the name if modelchanged receives an "isAbstract" event.


paint

public void paint(Graphics g)
See Also:
Fig.paint(java.awt.Graphics)

paintClarifiers

public void paintClarifiers(Graphics g)
Overrides:
paintClarifiers in class FigEdgeModelElement
Parameters:
g - the Graphics object
See Also:
FigEdgeModelElement.paintClarifiers(java.awt.Graphics)

getMiddleGroup

protected FigTextGroup getMiddleGroup()
Returns:
Returns the middleGroup.

layoutEdge

protected void layoutEdge()
Lays out the association edges as any other edge except for special rules for an association that loops back to the same class. For this it is snapped back to the bottom right corner if it resized to the point of not being visible.

See Also:
FigEdgePoly.layoutEdge()


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook