org.argouml.uml.diagram.sequence.ui
Class FigClassifierRole

java.lang.Object
  extended byorg.tigris.gef.presentation.Fig
      extended byorg.tigris.gef.presentation.FigGroup
          extended byorg.tigris.gef.presentation.FigNode
              extended byorg.argouml.uml.diagram.ui.FigNodeModelElement
                  extended byorg.argouml.uml.diagram.sequence.ui.FigClassifierRole
All Implemented Interfaces:
ArgoEventListener, ArgoNotationEventListener, Cloneable, Connecter, DelayedVChangeListener, EventListener, org.tigris.gef.di.GraphicElement, org.tigris.gef.di.GraphNode, HandlerFactory, Highlightable, KeyListener, MouseListener, NotationContext, PathContainer, PopupGenerator, PropertyChangeListener, Serializable, VetoableChangeListener

public class FigClassifierRole
extends FigNodeModelElement
implements MouseListener, HandlerFactory

Fig to show an object on a sequence diagram. The fig consists of an upper box that shows the name of the object (the owner) and a lifeline. The lifeline consists of lifeline elements. An element can be a dashed line (no link attached) or a rectangle (link attached).

See Also:
Serialized Form

Field Summary
static int MARGIN
          The margin between the outer box and the name and stereotype text box.
static int MIN_HEAD_HEIGHT
          The defaultheight of the object rectangle.
static int MIN_HEAD_WIDTH
          The defaultwidth of the object rectangle.
static int ROWDISTANCE
          The distance between two rows in the object rectangle.
static int WIDTH
          The width of an activation box.
 
Fields inherited from class org.argouml.uml.diagram.ui.FigNodeModelElement
ABSTRACT, ACTIVE, invisibleAllowed, LEAF, notationProviderName, ROOT, ROWHEIGHT, SHADOW_COLOR_ALPHA, SHADOW_COLOR_VALUE, STEREOHEIGHT
 
Fields inherited from class org.tigris.gef.presentation.FigNode
_blinkPorts, _highlight, ang135, ang225, ang315, ang45
 
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
FigClassifierRole(Object node)
           
FigClassifierRole(Object node, int x, int y, int w, int h)
           
 
Method Summary
 void addNode(int position, MessageNode node)
          Adds a node at the given position.
 Object deepHitPort(int x, int y)
          Returns the port for a given coordinate pair.
 Color getFillColor()
           
 boolean getFilled()
           
 DefaultHandler getHandler(HandlerStack stack, Object container, String uri, String localname, String qname, Attributes attributes)
           
 int getIndexOf(MessageNode node)
          Returns the index of a given node.
 Color getLineColor()
           
 int getLineWidth()
           
 MessageNode getNode(int position)
          Gets a node that has the given position (creates new nodes if needed).
 int getNodeCount()
           
 Fig getPortFig(Object messageNode)
           
static boolean isCallMessage(Object message)
           
static boolean isCreateMessage(Object message)
           
static boolean isDestroyMessage(Object message)
           
static boolean isReturnMessage(Object message)
           
 Selection makeSelection()
          Override to return a custom SelectionResize class that will not allow handles on the north edge to be dragged.
protected  void modelChanged(PropertyChangeEvent mee)
          This is called after any part of the UML MModelElement has changed.
 void mouseReleased(MouseEvent me)
          When the mouse button is released, this fig will be moved into position.
 MessageNode nextNode(MessageNode node)
          Returns the node that's next to the given node.
 MessageNode previousNode(MessageNode node)
          Returns the node that's before the given node in the nodes list.
 void renderingChanged()
          Rerenders the fig.
 void setBoundsImpl(int x, int y, int w, int h)
          Sets the bounds and coordinates of this Fig.
 void setFillColor(Color col)
           
 void setFilled(boolean filled)
           
 void setLineWidth(int w)
          Changing the line width should only change the line width of the outerbox and the lifeline.
 void setOwner(Object own)
          In ArgoUML, for every Fig, this setOwner() function may only be called twice: Once after the fig is created, with a non-null argument, and once at end-of-life of the Fig, with a null argument.
 void superTranslate(int dx, int dy)
          This method is overridden in order to ignore change of y co-ordinate during drag.
 void updateActivations()
          First removes all current activation boxes, then add new ones to the figobject depending on the state of the nodes.
protected  void updateBounds()
          The width of the FigClassifierRole should be equal to the width of the name or stereo text box.
protected  void updateListeners(Object oldOwner, Object newOwner)
          Implementations of this method should register/unregister the fig for all (model)events.
protected  void updateNameText()
          Constructs the contents of the name text box and upates the name text box accordingly.
protected  void updateStereotypeText()
          Updates the text of the sterotype FigText.
 
Methods inherited from class org.argouml.uml.diagram.ui.FigNodeModelElement
addElementListener, addElementListener, addElementListener, addEnclosedFig, allowRemoveFromDiagram, buildModifierPopUp, buildVisibilityPopUp, calcBounds, classNameAndBounds, clone, createFeatureIn, damage, delayedVetoableChange, deleteFromModel, displace, elementOrdering, enableSizeChecking, finalize, forceRepaintShadow, getBigPort, getContextNotation, getDiElement, getEnclosedFigs, getEncloser, getEnclosingFig, getItalicLabelFont, getItemUID, getLabelFont, getName, getNameBounds, getNameFig, getPopUpActions, getPopupAddOffset, getRemoveDelegate, getShadowSize, getStereotypeFig, getTipString, hit, hitClarifier, initNotationProviders, isCheckSize, isDragConnectable, isEditable, isPartlyOwner, isPartlyOwner, isPathVisible, isReadyToEdit, keyPressed, keyReleased, keyTyped, mouseClicked, notationAdded, notationChanged, notationProviderAdded, notationProviderRemoved, notationRemoved, paint, paintClarifiers, placeString, postLoad, propertyChange, removeAllElementListeners, removeElementListener, removeEnclosedFig, removeFromDiagram, removeFromDiagramImpl, setBigPort, setContextNotation, setDiElement, setEditable, setEncloser, setEnclosingFig, setItemUID, setLayer, setName, setNameFig, setPathVisible, setReadyToEdit, setShadowSize, setShadowSizeFriend, setSuppressCalcBounds, setVisible, showHelp, textEdited, textEditStarted, vetoableChange
 
Methods inherited from class org.tigris.gef.presentation.FigNode
addFigEdge, bindPort, cleanUp, contains, dispose, endTrans, getFigEdges, getFigEdges, getHighlight, getPortFigs, getPortSector, hidePorts, hitPort, hitPort, isBlinkPorts, mouseEntered, mouseExited, mousePressed, paint, removeFigEdge, removePort, setBlinkPorts, setHighlight, showPorts, translateImpl, updateEdges
 
Methods inherited from class org.tigris.gef.presentation.FigGroup
addFig, addFigs, deepSelect, elements, getDisplayedFigs, getExtraFrameSpace, getFigAt, getFigCount, getFigPosn, getFigs, getFont, getFontFamily, getFontSize, getPrivateData, getSubFigBounds, getTextColor, getTextFillColor, getTextFilled, hitFig, isReshapable, isRotatable, iterator, parseDynObjects, removeAll, removeFig, setExtraFrameSpace, setFigs, setFigs, setFont, setFontFamily, setFontSize, setLineColor, setPrivateData, setTextColor, setTextFillColor, setTextFilled
 
Methods inherited from class org.tigris.gef.presentation.Fig
addAnnotation, addPoint, addPropertyChangeListener, align, center, connectionPoint, contains, contains, countCornersContained, createDrag, firePropChange, firePropChange, firePropChange, getAnnotationOwner, getAnnotationStrategy, getBounds, getBounds, getCenter, getClosestPoint, getContext, getDashed, getDashed01, getDashedString, getFilled01, getFirstPoint, getGravityPoints, getGroup, getHalfHeight, getHalfWidth, getHandleBox, getHeight, getId, getLastPoint, getLayer, getLocation, getLocked, getMinimumSize, getNumPoints, getOwner, getPerimeterLength, getPoint, getPoints, getPreferredSize, getResource, getSingle, getSize, getTrapRect, getUseTrapRect, getVisState, getWidth, getX, getXs, getY, getYs, hasFillColor, hasLineColor, initAnnotations, insertPoint, intersects, intersectsPerimeter, isAnnotation, isCopyable, isCutable, isLowerRightResizable, isMovable, isRemoveStarted, isResizable, isSelectable, isSelected, isVisible, pointAlongPerimeter, postSave, preSave, print, redraw, removeAnnotation, removePoint, removePropertyChangeListener, reorder, routingRect, savingAllowed, setAnnotationOwner, setAnnotationStatus, setAnnotationStrategy, setBounds, setBounds, setCenter, setContext, setDashed, setDashedString, setGroup, setHandleBox, setHeight, setLocation, setLocation, setLocked, setMovable, setNumPoints, setPoint, setPoint, setPoint, setPoint, setPoints, setResizable, setResource, setSavingAllowed, setSize, setSize, setWidth, setX, setXs, setY, setYs, stuffBounds, stuffPointAlongPerimeter, translate, translateAnnotations, unsetAnnotationOwner, updateAnnotationPositions, within
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed
 
Methods inherited from interface org.argouml.cognitive.Highlightable
getHighlight, setHighlight
 
Methods inherited from interface org.tigris.gef.di.GraphicElement
getId, getOwner, routingRect
 

Field Detail

WIDTH

public static final int WIDTH
The width of an activation box.

See Also:
Constant Field Values

MARGIN

public static final int MARGIN
The margin between the outer box and the name and stereotype text box.

See Also:
Constant Field Values

ROWDISTANCE

public static final int ROWDISTANCE
The distance between two rows in the object rectangle.

See Also:
Constant Field Values

MIN_HEAD_HEIGHT

public static final int MIN_HEAD_HEIGHT
The defaultheight of the object rectangle. That's 3 times the rowheight + 3 times a distance of 2 between the rows + the stereoheight.

See Also:
Constant Field Values

MIN_HEAD_WIDTH

public static final int MIN_HEAD_WIDTH
The defaultwidth of the object rectangle.

See Also:
Constant Field Values
Constructor Detail

FigClassifierRole

public FigClassifierRole(Object node,
                         int x,
                         int y,
                         int w,
                         int h)

FigClassifierRole

public FigClassifierRole(Object node)
Method Detail

mouseReleased

public void mouseReleased(MouseEvent me)
When the mouse button is released, this fig will be moved into position.

Specified by:
mouseReleased in interface MouseListener
See Also:
MouseListener.mouseReleased(MouseEvent)

updateNameText

protected void updateNameText()
Constructs the contents of the name text box and upates the name text box accordingly. The contents of the name text box itself are NOT updated.

Overrides:
updateNameText in class FigNodeModelElement
See Also:
FigNodeModelElement.updateNameText()

getNodeCount

public int getNodeCount()

setBoundsImpl

public void setBoundsImpl(int x,
                          int y,
                          int w,
                          int h)
Sets the bounds and coordinates of this Fig. The outerbox (the black box around the upper box) and the background box (the white box at the background) are scaled to the given size. The name text box and the stereo text box are moved to a correct position.

See Also:
Fig.setBoundsImpl(int, int, int, int)

superTranslate

public void superTranslate(int dx,
                           int dy)
This method is overridden in order to ignore change of y co-ordinate during drag.

See Also:
FigNode.superTranslate(int, int)

isCallMessage

public static boolean isCallMessage(Object message)

isReturnMessage

public static boolean isReturnMessage(Object message)

isCreateMessage

public static boolean isCreateMessage(Object message)

isDestroyMessage

public static boolean isDestroyMessage(Object message)

updateActivations

public void updateActivations()
First removes all current activation boxes, then add new ones to the figobject depending on the state of the nodes.


getHandler

public DefaultHandler getHandler(HandlerStack stack,
                                 Object container,
                                 String uri,
                                 String localname,
                                 String qname,
                                 Attributes attributes)
                          throws SAXException
Specified by:
getHandler in interface HandlerFactory
Throws:
SAXException
See Also:
HandlerFactory.getHandler( org.tigris.gef.persistence.pgml.HandlerStack, java.lang.Object, java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

updateBounds

protected void updateBounds()
The width of the FigClassifierRole should be equal to the width of the name or stereo text box.

Overrides:
updateBounds in class FigNodeModelElement
See Also:
FigNodeModelElement.updateBounds()

setLineWidth

public void setLineWidth(int w)
Changing the line width should only change the line width of the outerbox and the lifeline. 0 Values are ignored.

See Also:
Fig.setLineWidth(int)

setFillColor

public void setFillColor(Color col)
See Also:
Fig.setFillColor(java.awt.Color)

setFilled

public void setFilled(boolean filled)
See Also:
Fig.setFilled(boolean)

getFillColor

public Color getFillColor()
See Also:
Fig.getFillColor()

getFilled

public boolean getFilled()
See Also:
Fig.getFilled()

getLineColor

public Color getLineColor()
See Also:
Fig.getLineColor()

getLineWidth

public int getLineWidth()
See Also:
Fig.getLineWidth()

updateListeners

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

An explanation of the original purpose of this method is given in issue 1321.

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 imperative that indeed ALL listeners are updated, since they are ALL removed by the call to removeElementListener.

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

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

Overrides:
updateListeners in class FigNodeModelElement
Parameters:
newOwner - null, or the owner of this. The former means that listeners have to be removed, the latter that they have to be set. TODO: Should this not be boolean, to clarify?
See Also:
FigNodeModelElement#updateListeners(java.lang.Object)

modelChanged

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

Overrides:
modelChanged in class FigNodeModelElement
Parameters:
mee - the ModelElementEvent that caused the change
See Also:
FigNodeModelElement.modelChanged(java.beans.PropertyChangeEvent)

renderingChanged

public void renderingChanged()
Description copied from class: FigNodeModelElement
Rerenders the fig.

This functionality was originally the functionality of modelChanged but modelChanged takes the event now into account.

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

deepHitPort

public Object deepHitPort(int x,
                          int y)
Returns the port for a given coordinate pair. Normally deepHitPort returns the owner of the fig in the FigGroup that is present at the given coordinate pair (returning figs that are added later first). In this case it returns a MessagePort.

See Also:
FigNode.deepHitPort(int, int)

setOwner

public void setOwner(Object own)
Description copied from class: FigNodeModelElement
In ArgoUML, for every Fig, this setOwner() function may only be called twice: Once after the fig is created, with a non-null argument, and once at end-of-life of the Fig, with a null argument. It is not allowed in ArgoUML to change the owner of a fig in any other way.

Hence, during the lifetime of this Fig object, the owner shall go from null to some UML object, and to null again.

Overrides:
setOwner in class FigNodeModelElement
See Also:
Fig.setOwner(java.lang.Object)

getIndexOf

public int getIndexOf(MessageNode node)
Returns the index of a given node.

Parameters:
node - is the given node
Returns:
the index

nextNode

public MessageNode nextNode(MessageNode node)
Returns the node that's next to the given node.

Parameters:
node - is the given node
Returns:
the Node

previousNode

public MessageNode previousNode(MessageNode node)
Returns the node that's before the given node in the nodes list.

Parameters:
node - is the given node
Returns:
the node

getPortFig

public Fig getPortFig(Object messageNode)
See Also:
FigNode.getPortFig(java.lang.Object)

addNode

public void addNode(int position,
                    MessageNode node)
Adds a node at the given position.

Parameters:
position - the position in which the node will be added
node - the node to be added

getNode

public MessageNode getNode(int position)
Gets a node that has the given position (creates new nodes if needed).

Parameters:
position - the position of the resulting node
Returns:
the node with the given position

makeSelection

public Selection makeSelection()
Override to return a custom SelectionResize class that will not allow handles on the north edge to be dragged.

Overrides:
makeSelection in class FigNodeModelElement
See Also:
Fig.makeSelection()

updateStereotypeText

protected void updateStereotypeText()
Description copied from class: FigNodeModelElement
Updates the text of the sterotype FigText. Override in subclasses to get wanted behaviour.

Overrides:
updateStereotypeText in class FigNodeModelElement
See Also:
FigNodeModelElement.updateStereotypeText()


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook