|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.tigris.gef.presentation.Fig
org.tigris.gef.presentation.FigGroup
org.tigris.gef.presentation.FigNode
org.argouml.uml.diagram.ui.FigNodeModelElement
org.argouml.uml.diagram.use_case.ui.FigUseCase
A fig to display use cases on use case diagrams.
Realised as a solid oval containing the name of the use case. Optionally may be split into two compartments, with the lower compartment displaying the extension points for the use case.
Implements all interfaces through its superclasses.
There is some coordinate geometry to be done to fit rectangular text boxes inside an elipse. The rectangular text box contains the name and any extension points if shown, and is deemed to be of height 2h and width 2w. We allow a margin of p above the top and below the bottom of the box, so we know the height of the elipse, 2b = 2h + 2p.
The formula for an elipse of width 2a and height 2b, centred on the origin, is
x^2/a^2 + y^2/b^2 = 1.
We know that a corner of the rectangle is at coordinate (w,h), since the rectangle must also be centred on the origin to fit within the elipse. Subsituting these values for x and y in the formula above, we can compute a, half the width of the elipse, since we know b.
a = wb/sqrt(b^2 - h^2).
But b was defined in terms of the height of the rectangle plus agreed padding at the top, so we can write.
a = (wh + wb)/ sqrt(2hp + p^2)
Given we now know a and b, we can find the coordinates of any partition line required between use case name and extension points.
Finally we need to transform our coordinates, to recognise that the origin is at our top left corner, and the Y coordinates are reversed.
Nested Class Summary | |
class |
FigUseCase.FigMyCircle
FigMyCircle is a FigCircle with corrected connectionPoint method: this methods calculates where a connected edge ends. |
Field Summary | |
protected FigUseCase.FigMyCircle |
_bigPort
UML use cases do not really have ports, so just define one big one so that users can drag edges to or from any point in the icon. |
protected FigUseCase.FigMyCircle |
_cover
We don't use _bigPort for the actual graphics of the oval. |
protected org.tigris.gef.presentation.FigRect |
_epBigPort
The rectangle for the entire extension point box. |
protected org.tigris.gef.presentation.FigLine |
_epSep
The line separating name and extension points. |
protected org.tigris.gef.presentation.FigGroup |
_epVec
The vector of graphics for extension points (if any). |
protected CompartmentFigText |
_highlightedFigText
Text highlighted by mouse actions on the diagram. |
protected int |
_MIN_VERT_PADDING
The minimum padding allowed above and below the rectangle for the use case name and extension points to the top of the use case oval itself. |
protected int |
_SPACER
Space above and below the line separating name from extension points. |
Fields inherited from class org.argouml.uml.diagram.ui.FigNodeModelElement |
_enclosedFigs, _encloser, _name, _readyToEdit, _shadowSize, _stereo, checkSize, ITALIC_LABEL_FONT, LABEL_FONT, MARGIN, ROWHEIGHT, STEREOHEIGHT, suppressCalcBounds |
Fields inherited from class org.tigris.gef.presentation.FigNode |
_blinkPorts, _figEdges, _highlight, ang135, ang225, ang315, ang45 |
Fields inherited from class org.tigris.gef.presentation.FigGroup |
_dynObjects, _figs |
Fields inherited from class org.tigris.gef.presentation.Fig |
_allowsSaving, _context, _dashes, _displayed, _fillColor, _filled, _group, _h, _layer, _lineColor, _lineWidth, _locked, _resource, _shown, _w, _x, _y, an, annotationOwner, annotationStatus, BORDER, DASH_ARRAYS, DASHED_CHOICES, MIN_SIZE |
Constructor Summary | |
FigUseCase()
Constructor for a new use case fig. |
|
FigUseCase(org.tigris.gef.graph.GraphModel gm,
java.lang.Object node)
A version of the constructor used to associated the Fig with a particular NSUML object. |
Method Summary | |
java.lang.Object |
clone()
Make a copy of the current fig. |
protected void |
createFeatureIn(org.tigris.gef.presentation.FigGroup fg,
java.awt.event.InputEvent ie)
Create a new "feature" (extension point) in the use case fig. |
java.awt.Color |
getFillColor()
Get the line colour for the use case oval. |
boolean |
getFilled()
Get whether the use case oval is to be filled. |
java.util.Vector |
getGravityPoints()
Makes sure that the edges stick to the elipse fig of the usecase. |
java.awt.Color |
getLineColor()
Get the line colour for the use case oval. |
int |
getLineWidth()
Get the line width for the use case oval. |
java.awt.Dimension |
getMinimumSize()
Compute the minimum acceptable size of the use case. |
java.util.Vector |
getPopUpActions(java.awt.event.MouseEvent me)
Build a collection of menu items relevant for a right-click popup menu on a Use Case. |
boolean |
isExtensionPointVisible()
Returns whether the extension points are currently displayed. |
void |
keyPressed(java.awt.event.KeyEvent ke)
Deal with a key being pressed. |
org.tigris.gef.base.Selection |
makeSelection()
Creates a set of handles for dragging generalization/specializations or associations. |
protected void |
modelChanged(ru.novosoft.uml.MElementEvent mee)
Adjust the fig in the light of some change to the model. |
void |
mouseExited(java.awt.event.MouseEvent me)
Deal with the mouse leaving the fig. |
void |
mousePressed(java.awt.event.MouseEvent me)
React to a mouse key being pressed. |
java.lang.String |
placeString()
The text string to be used as the default name of the new use case fig. |
void |
setBounds(int x,
int y,
int w,
int h)
Change the boundary of the use case. |
void |
setExtensionPointVisible(boolean isVisible)
Set the visibility of the extension point compartment. |
void |
setFillColor(java.awt.Color col)
Set the fill colour for the use case oval. |
void |
setFilled(boolean f)
Set whether the use case oval is to be filled. |
void |
setLineColor(java.awt.Color col)
Set the line colour for the use case oval. |
void |
setLineWidth(int w)
Set the line width for the use case oval. |
void |
setOwner(java.lang.Object node)
Associate this fig with a particular NSUML object. |
protected void |
textEdited(org.tigris.gef.presentation.FigText ft)
Invoked when text has been edited. |
protected void |
updateExtensionPoint()
Updates the extensionpoints in the fig |
protected void |
updateNameText()
Updates the text of the name FigText. |
protected void |
updateStereotypeText()
Updates the text of the sterotype FigText. |
Methods inherited from class org.argouml.uml.diagram.ui.FigNodeModelElement |
calcBounds, damage, delayedVetoableChange, delete, dispose, elementOrdering, enableSizeChecking, finalize, getContextNotation, getEnclosedFigs, getEnclosingFig, getItemUID, getNameFig, getShadowSize, getTipString, getUpdatedSize, hit, hitClarifier, isPartlyOwner, isPartlyOwner, keyReleased, keyTyped, listRoleItemSet, mouseClicked, notationAdded, notationChanged, notationProviderAdded, notationProviderRemoved, notationRemoved, paintClarifiers, postLoad, propertyChange, propertySet, recovered, removed, renderingChanged, roleAdded, roleRemoved, setEnclosingFig, setItemUID, setShadowSize, updateBounds, updateListeners, vetoableChange |
Methods inherited from class org.tigris.gef.presentation.FigNode |
addFigEdge, bindPort, cleanUp, contains, deepHitPort, endTrans, getBlinkPorts, getFigEdges, getHighlight, getPortFig, getPortFigs, getPortSector, hidePorts, hitPort, hitPort, mouseEntered, mouseReleased, paint, removeFigEdge, removePort, setBlinkPorts, setHighlight, showPorts, startTrans, superTranslate, translate, updateEdges |
Methods inherited from class org.tigris.gef.presentation.FigGroup |
addFig, elements, getDisplayedFigs, getFigs, getFont, getFontFamily, getFontSize, getPrivateData, getTextColor, getTextFillColor, getTextFilled, hitFig, isReshapable, isResizable, isRotatable, parseDynObjects, removeAll, removeFig, setFigs, setFont, setFontFamily, setFontSize, setPrivateData, setTextColor, setTextFillColor, setTextFilled |
Methods inherited from class org.tigris.gef.presentation.Fig |
addAnnotation, addPoint, addPropertyChangeListener, align, center, classNameAndBounds, connectionPoint, contains, contains, countCornersContained, createDrag, drawDashedLine, drawDashedPerimeter, firePropChange, firePropChange, firePropChange, getAnnotationOwner, getAnnotationStrategy, getBounds, getClosestPoint, getContext, getDashed, getDashed01, getDashedString, getFilled01, getFirstPoint, getGroup, getHalfHeight, getHalfWidth, getHandleBox, getHeight, getId, getLastPoint, getLayer, getLocation, getLocked, getNumPoints, getOwner, getPerimeterLength, getPoints, getPoints, getPreferedSize, getResource, getSize, getTrapRect, getUseTrapRect, getVisState, getWidth, getX, getXs, getY, getYs, initAnnotations, insertPoint, intersects, isAnnotation, isDisplayed, isLowerRightResizable, isMovable, OK, pointAlongPerimeter, postSave, preSave, print, removeAnnotation, removeAnnotation, removePoint, removePropertyChangeListener, reorder, routingRect, savingAllowed, setAnnotationOwner, setAnnotationStatus, setAnnotationStrategy, setBounds, setCenter, setContext, setDashed, setDashedString, setDisplayed, setGroup, setHandleBox, setHeight, setLayer, setLocation, setLocation, setLocked, setNumPoints, setPoints, setPoints, setPoints, setPoints, setPoints, setResource, setSavingAllowed, setSize, setSize, setVisState, setWidth, setX, setXs, setY, setYs, stuffBounds, stuffPointAlongPerimeter, unsetAnnotationOwner, updateAnnotationPositions, updateVisState, 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, mouseReleased |
Methods inherited from interface org.tigris.gef.ui.Highlightable |
addPropertyChangeListener, removePropertyChangeListener |
Field Detail |
protected final int _MIN_VERT_PADDING
The minimum padding allowed above and below the rectangle for the use case name and extension points to the top of the use case oval itself.
protected final int _SPACER
Space above and below the line separating name from extension points. The line takes a further 1 pixel.
protected FigUseCase.FigMyCircle _bigPort
UML use cases do not really have ports, so just define one big one so that users can drag edges to or from any point in the icon.
protected FigUseCase.FigMyCircle _cover
We don't use _bigPort for the actual graphics of the oval. We define an identical oval that sits on top of it.
protected org.tigris.gef.presentation.FigLine _epSep
The line separating name and extension points.
protected org.tigris.gef.presentation.FigGroup _epVec
The vector of graphics for extension points (if any). First one is the rectangle for the entire extension points box.
protected org.tigris.gef.presentation.FigRect _epBigPort
The rectangle for the entire extension point box.
protected CompartmentFigText _highlightedFigText
Text highlighted by mouse actions on the diagram. Assumed to belong to the extension point compartment.
Constructor Detail |
public FigUseCase()
Constructor for a new use case fig. We work out the smallest oval that will fit round.
At creation the extension point box is not showing (for consistency with existing implementations). We can show it later.
public FigUseCase(org.tigris.gef.graph.GraphModel gm, java.lang.Object node)
A version of the constructor used to associated the Fig with a particular NSUML object.
Not clear that this is ever used. The load routines use the main constructor and call setOwner directly.
gm
- The graph model to associate with this Fig. Ignored in this
implementation.node
- The NSUML object to associate with this Fig.Method Detail |
public java.lang.String placeString()
The text string to be used as the default name of the new use case fig. However this seems in general to be immediately overwritten - presumably somewhere in the creation code for the object, which choses to define a name.
Note. Good UML would probably prefer a name starting with a capital and no spaces!
placeString
in class FigNodeModelElement
public java.lang.Object clone()
Make a copy of the current fig.
Uses the generic superclass clone which gives a vector of all the figs. Then initialize our instance variables from this vector.
public java.util.Vector getPopUpActions(java.awt.event.MouseEvent me)
Build a collection of menu items relevant for a right-click popup menu on a Use Case.
Adds to the generic pop up items from the parent.
getPopUpActions
in interface org.tigris.gef.ui.PopupGenerator
getPopUpActions
in class FigNodeModelElement
me
- The mouse event that generated this popup.
public boolean isExtensionPointVisible()
Returns whether the extension points are currently displayed.
true
if the attributes are visible,
false
otherwise.public void setExtensionPointVisible(boolean isVisible)
Set the visibility of the extension point compartment. This is called from outside this class when the user sets visibility explicitly through the style panel or the context sensitive pop-up menu.
We don't change the size of the use case, so we just have to mark the
extension point elements' visibility. setBounds(int, int,
int, int)
will do the relayout (with name in the middle) for us.
isVisible
- true
if the compartment should be shown,
false
otherwise.public org.tigris.gef.base.Selection makeSelection()
Creates a set of handles for dragging generalization/specializations or associations.
makeSelection
in class FigNodeModelElement
public void setOwner(java.lang.Object node)
Associate this fig with a particular NSUML object.
Associates the node with the "bigPort" that is the whole of this object.
Must be public, since called directly, e.g. by the load routines.
setOwner
in class FigNodeModelElement
node
- The NSUML object to associate with this fig.public java.awt.Dimension getMinimumSize()
Compute the minimum acceptable size of the use case.
We work out the minimum size of the text box, and from that the radii of the enclosing ellipse.
public void setBounds(int x, int y, int w, int h)
Change the boundary of the use case.
If we are called with less than the minimum size, we impose the minimum size.
We place the name and extension points at the centre of the rectangle.
Set the bounds of all components of the Fig.
x
- X coordinate of upper left cornery
- Y coordinate of upper left cornerw
- width of bounding boxh
- height of bounding boxpublic void setLineColor(java.awt.Color col)
Set the line colour for the use case oval.
This involves setting the _cover oval, not the bigPort.
col
- The colour desired.public java.awt.Color getLineColor()
Get the line colour for the use case oval.
This involves getting the _cover oval colour, not the bigPort.
public void setFillColor(java.awt.Color col)
Set the fill colour for the use case oval.
This involves setting the _cover oval, not the bigPort.
col
- The colour desired.public java.awt.Color getFillColor()
Get the line colour for the use case oval.
This involves getting the _cover oval colour, not the bigPort.
public void setFilled(boolean f)
Set whether the use case oval is to be filled.
This involves setting the _cover oval, not the bigPort.
f
- true
if the oval is to be filled,
false
if not.public boolean getFilled()
Get whether the use case oval is to be filled.
This involves getting the _cover oval, not the bigPort.
true
if the oval is to be filled,
false
if not.public void setLineWidth(int w)
Set the line width for the use case oval.
This involves setting the _cover oval, not the bigPort.
w
- The line width desired.public int getLineWidth()
Get the line width for the use case oval.
This involves getting the _cover oval colour, not the bigPort.
public void mousePressed(java.awt.event.MouseEvent me)
React to a mouse key being pressed.
me
- The mouse action that caused us to be invoked.public void mouseExited(java.awt.event.MouseEvent me)
Deal with the mouse leaving the fig. Unhighlight the fig.
me
- The mouse action that caused us to be invoked.public void keyPressed(java.awt.event.KeyEvent ke)
Deal with a key being pressed.
We deal with UP and DOWN, and use these to move through the list of selected extension points. We deal with ENTER and use that to start the text editor.
keyPressed
in interface java.awt.event.KeyListener
keyPressed
in class FigNodeModelElement
ke
- The key event that caused us to be invoked.protected void textEdited(org.tigris.gef.presentation.FigText ft) throws java.beans.PropertyVetoException
Invoked when text has been edited.
We check that it is one of the extension point compartments and then parse accordingly.
textEdited
in class FigNodeModelElement
ft
- The text that has been edited.
java.beans.PropertyVetoException
protected void createFeatureIn(org.tigris.gef.presentation.FigGroup fg, java.awt.event.InputEvent ie)
Create a new "feature" (extension point) in the use case fig.
Extension points are not strictly features, but that is a historical accident of naming. This creates a new entry in the extension point vector.
createFeatureIn
in class FigNodeModelElement
fg
- The fig group to which this applies (which must be the
extension point vector).ie
- The input event that triggered us. In the current
implementation a mouse double click.protected void modelChanged(ru.novosoft.uml.MElementEvent mee)
Adjust the fig in the light of some change to the model.
Called both when there has been a change to notation, and when there has been an NSUML event.
modelChanged
in class FigNodeModelElement
protected void updateExtensionPoint()
protected void updateNameText()
FigNodeModelElement
updateNameText
in class FigNodeModelElement
FigNodeModelElement.updateNameText()
public java.util.Vector getGravityPoints()
Fig.getGravityPoints()
protected void updateStereotypeText()
FigNodeModelElement
updateStereotypeText
in class FigNodeModelElement
FigNodeModelElement.updateStereotypeText()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2003 (20030829) | ArgoUML Project Home | ArgoUML Cookbook |