org.argouml.uml.diagram.static_structure.ui
Class FigComment

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.static_structure.ui.FigComment
All Implemented Interfaces:
ArgoEventListener, ArgoNotationEventListener, Cloneable, Connecter, DelayedVChangeListener, EventListener, org.tigris.gef.di.GraphicElement, org.tigris.gef.di.GraphNode, Highlightable, KeyListener, MouseListener, NotationContext, PathContainer, PopupGenerator, PropertyChangeListener, Serializable, VetoableChangeListener

public class FigComment
extends FigNodeModelElement
implements VetoableChangeListener, DelayedVChangeListener, MouseListener, KeyListener, PropertyChangeListener

Class to display a UML comment in a diagram.

See Also:
Serialized Form

Field Summary
 
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
FigComment()
          The main constructor used for file loading.
FigComment(GraphModel gm, Object node)
          Construct a new comment.
 
Method Summary
 Object clone()
          Clone this figure.
 void delayedVetoableChange(PropertyChangeEvent pce)
           
 String getBody()
           
 Point getClosestPoint(Point anotherPt)
           
 Color getFillColor()
           
 boolean getFilled()
           
 Color getLineColor()
           
 int getLineWidth()
           
 Dimension getMinimumSize()
          Get the minimum size for the note figure.
 Rectangle getNameBounds()
          Always returns null as the FigComment does not display its name.
 boolean getUseTrapRect()
           
 void keyPressed(KeyEvent ke)
           
 void keyReleased(KeyEvent ke)
          Not used, do nothing.
 void keyTyped(KeyEvent ke)
           
 Selection makeSelection()
           
protected  void modelChanged(PropertyChangeEvent mee)
          This is called after any part of the UML ModelElement (the comment) has changed.
 void mouseClicked(MouseEvent me)
          If the user double clicks on any part of this FigNode, pass it down to one of the internal Figs.
 void paint(Graphics g)
          Overridden to paint shadows.
 String placeString()
          Get the default text for this figure.
 void propertyChange(PropertyChangeEvent pve)
           
protected  void setBoundsImpl(int px, int py, int w, int h)
           
 void setEnclosingFig(Fig encloser)
          Updates the modelelement container if the fig is moved in or out another fig.
 void setFillColor(Color col)
           
 void setFilled(boolean f)
           
 void setLineColor(Color col)
           
 void setLineWidth(int w)
           
 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 storeBody(String body)
          Stores the body text in the associated model element.
protected  void textEdited(FigText ft)
          This method is called after the user finishes editing a text field that is in the FigNodeModelElement.
protected  void textEditStarted(FigText ft)
          This method is called when the user doubleclicked on the text field, and starts editing.
protected  void updateBounds()
          set some new bounds.
protected  void updateStereotypeText()
          Updates the text of the sterotype FigText.
 void vetoableChange(PropertyChangeEvent pce)
           
 
Methods inherited from class org.argouml.uml.diagram.ui.FigNodeModelElement
addElementListener, addElementListener, addElementListener, addEnclosedFig, allowRemoveFromDiagram, buildModifierPopUp, buildVisibilityPopUp, calcBounds, classNameAndBounds, createFeatureIn, damage, deleteFromModel, displace, elementOrdering, enableSizeChecking, finalize, forceRepaintShadow, getBigPort, getContextNotation, getDiElement, getEnclosedFigs, getEncloser, getEnclosingFig, getItalicLabelFont, getItemUID, getLabelFont, getName, getNameFig, getPopUpActions, getPopupAddOffset, getRemoveDelegate, getShadowSize, getStereotypeFig, getTipString, hit, hitClarifier, initNotationProviders, isCheckSize, isDragConnectable, isEditable, isPartlyOwner, isPartlyOwner, isPathVisible, isReadyToEdit, notationAdded, notationChanged, notationProviderAdded, notationProviderRemoved, notationRemoved, paintClarifiers, postLoad, removeAllElementListeners, removeElementListener, removeEnclosedFig, removeFromDiagram, removeFromDiagramImpl, renderingChanged, setBigPort, setContextNotation, setDiElement, setEditable, setEncloser, setItemUID, setLayer, setName, setNameFig, setPathVisible, setReadyToEdit, setShadowSize, setShadowSizeFriend, setSuppressCalcBounds, setVisible, showHelp, updateListeners, updateNameText
 
Methods inherited from class org.tigris.gef.presentation.FigNode
addFigEdge, bindPort, cleanUp, contains, deepHitPort, dispose, endTrans, getFigEdges, getFigEdges, getHighlight, getPortFig, getPortFigs, getPortSector, hidePorts, hitPort, hitPort, isBlinkPorts, mouseEntered, mouseExited, mousePressed, mouseReleased, paint, removeFigEdge, removePort, setBlinkPorts, setHighlight, showPorts, superTranslate, 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, 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, getContext, getDashed, getDashed01, getDashedString, getFilled01, getFirstPoint, getGravityPoints, getGroup, getHalfHeight, getHalfWidth, getHandleBox, getHeight, getId, getLastPoint, getLayer, getLocation, getLocked, getNumPoints, getOwner, getPerimeterLength, getPoint, getPoints, getPreferredSize, getResource, getSingle, getSize, getTrapRect, 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
mouseEntered, mouseExited, mousePressed, mouseReleased
 
Methods inherited from interface org.argouml.cognitive.Highlightable
getHighlight, setHighlight
 
Methods inherited from interface org.tigris.gef.di.GraphicElement
getId, getOwner, routingRect
 

Constructor Detail

FigComment

public FigComment()
The main constructor used for file loading.


FigComment

public FigComment(GraphModel gm,
                  Object node)
Construct a new comment.

Parameters:
gm - the graphmodel
node - the underlying UML Comment
Method Detail

placeString

public String placeString()
Get the default text for this figure.

Overrides:
placeString in class FigNodeModelElement
Returns:
The default text for this figure.

clone

public Object clone()
Clone this figure.

Overrides:
clone in class FigNodeModelElement
Returns:
The cloned figure.
See Also:
Object.clone()

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)

mouseClicked

public void mouseClicked(MouseEvent me)
If the user double clicks on any part of this FigNode, pass it down to one of the internal Figs. This allows the user to initiate direct text editing.

Specified by:
mouseClicked in interface MouseListener
Overrides:
mouseClicked in class FigNodeModelElement
See Also:
MouseListener.mouseClicked(java.awt.event.MouseEvent)

vetoableChange

public void vetoableChange(PropertyChangeEvent pce)
Specified by:
vetoableChange in interface VetoableChangeListener
Overrides:
vetoableChange in class FigNodeModelElement
See Also:
VetoableChangeListener.vetoableChange(java.beans.PropertyChangeEvent)

delayedVetoableChange

public void delayedVetoableChange(PropertyChangeEvent pce)
Specified by:
delayedVetoableChange in interface DelayedVChangeListener
Overrides:
delayedVetoableChange in class FigNodeModelElement
See Also:
DelayedVChangeListener.delayedVetoableChange(java.beans.PropertyChangeEvent)

propertyChange

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

keyPressed

public void keyPressed(KeyEvent ke)
Specified by:
keyPressed in interface KeyListener
Overrides:
keyPressed in class FigNodeModelElement
See Also:
KeyListener.keyPressed(java.awt.event.KeyEvent)

keyReleased

public void keyReleased(KeyEvent ke)
Not used, do nothing.

Specified by:
keyReleased in interface KeyListener
Overrides:
keyReleased in class FigNodeModelElement
See Also:
KeyListener.keyReleased(java.awt.event.KeyEvent)

keyTyped

public void keyTyped(KeyEvent ke)
Specified by:
keyTyped in interface KeyListener
Overrides:
keyTyped in class FigNodeModelElement
See Also:
KeyListener.keyTyped(java.awt.event.KeyEvent)

makeSelection

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

setLineColor

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

getLineColor

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

setFillColor

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

getFillColor

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

setFilled

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

getFilled

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

setLineWidth

public void setLineWidth(int w)
See Also:
Fig.setLineWidth(int)

getLineWidth

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

textEdited

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

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

textEditStarted

protected void textEditStarted(FigText ft)
Description copied from class: FigNodeModelElement
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, by calling notationProviderName.putValue("fullyHandleStereotypes", true);, but that seems not user-friendly. See issue 3838.

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

setEnclosingFig

public void setEnclosingFig(Fig encloser)
Description copied from class: FigNodeModelElement
Updates the modelelement container if the fig is moved in or out another fig. If this fig doesn't have an enclosing fig anymore, the namespace of the diagram will be the owning modelelement. If this fig is moved inside another FigNodeModelElement the owner of that fignodemodelelement will be the owning modelelement.

Overrides:
setEnclosingFig in class FigNodeModelElement
See Also:
Fig.setEnclosingFig(org.tigris.gef.presentation.Fig)

storeBody

public final void storeBody(String body)
Stores the body text in the associated model element.

Parameters:
body - The body text to store.

getUseTrapRect

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

getNameBounds

public Rectangle getNameBounds()
Always returns null as the FigComment does not display its name.

Overrides:
getNameBounds in class FigNodeModelElement
Returns:
bounding box for name

getMinimumSize

public Dimension getMinimumSize()
Get the minimum size for the note figure.

Returns:
The minimum size for the note figure.

setBoundsImpl

protected void setBoundsImpl(int px,
                             int py,
                             int w,
                             int h)
See Also:
Fig.setBounds(int, int, int, int)

updateBounds

protected void updateBounds()
Description copied from class: FigNodeModelElement
set some new bounds.

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

modelChanged

protected final void modelChanged(PropertyChangeEvent mee)
This is called after any part of the UML ModelElement (the comment) has changed. This method automatically updates the note FigText.

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

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()

getBody

public String getBody()

getClosestPoint

public Point getClosestPoint(Point anotherPt)
See Also:
Fig.getClosestPoint(java.awt.Point)

paint

public void paint(Graphics g)
Description copied from class: FigNodeModelElement
Overridden to paint shadows. This method supports painting shadows for any FigNodeModelElement. Any Figs that are nested within the FigNodeModelElement will be shadowed.

TODO: If g is not a Graphics2D shadows cannot be painted. This is a problem when saving the diagram as SVG.

Overrides:
paint in class FigNodeModelElement
Parameters:
g - is a Graphics that we paint this object on.
See Also:
Fig.paint(java.awt.Graphics)


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook