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

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.FigInterface
All Implemented Interfaces:
ArgoEventListener, ArgoNotationEventListener, java.lang.Cloneable, DelayedVChangeListener, java.util.EventListener, org.tigris.gef.ui.Highlightable, java.awt.event.KeyListener, ru.novosoft.uml.MElementListener, java.awt.event.MouseListener, NotationContext, org.tigris.gef.ui.PopupGenerator, java.beans.PropertyChangeListener, java.io.Serializable, java.beans.VetoableChangeListener

public class FigInterface
extends FigNodeModelElement

Class to display graphics for a UML Interface in a diagram.

See Also:
Serialized Form

Field Summary
protected  org.tigris.gef.presentation.FigRect _operBigPort
          The rectangle for the entire operations box.
protected  org.tigris.gef.presentation.FigGroup _operVec
          The vector of graphics for operations (if any).
protected  org.tigris.gef.presentation.FigRect _stereoLineBlinder
          A rectangle to blank out the line that would otherwise appear at the bottom of the stereotype text box.
protected static org.apache.log4j.Category cat
           
protected  CompartmentFigText highlightedFigText
          Text highlighted by mouse actions on the diagram.
 ru.novosoft.uml.foundation.core.MElementResidence resident
          Manages residency of an interface within a component on a deployment diagram.
 
Fields inherited from class org.argouml.uml.diagram.ui.FigNodeModelElement
_bigPort, _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
FigInterface()
          Main constructor for a FigInterface.
FigInterface(org.tigris.gef.graph.GraphModel gm, java.lang.Object node)
          Constructor for use if this figure is created for an existing interface node in the metamodel.
 
Method Summary
 java.lang.Object clone()
           
protected  void createFeatureIn(org.tigris.gef.presentation.FigGroup fg, java.awt.event.InputEvent ie)
           
 java.awt.Dimension getMinimumSize()
          Gets the minimum size permitted for an interface on the diagram.
protected  org.tigris.gef.presentation.FigText getNextVisibleFeature(org.tigris.gef.presentation.FigText ft, int i)
           
 org.tigris.gef.presentation.FigGroup getOperationsFig()
           
 java.util.Vector getPopUpActions(java.awt.event.MouseEvent me)
          Build a collection of menu items relevant for a right-click popup menu on an Interface.
protected  org.tigris.gef.presentation.FigText getPreviousVisibleFeature(org.tigris.gef.presentation.FigText ft, int i)
           
 boolean isOperationVisible()
          Returns the status of the operation field.
 void keyPressed(java.awt.event.KeyEvent ke)
           
 org.tigris.gef.base.Selection makeSelection()
           
protected  void modelChanged(ru.novosoft.uml.MElementEvent mee)
          This is called aftern any part of the UML MModelElement has changed.
 void mouseClicked(java.awt.event.MouseEvent me)
          If the user double clicks on any part of this FigNode, pass it down to one of the internal Figs.
 void mouseExited(java.awt.event.MouseEvent me)
           
 java.lang.String placeString()
          Reply text to be shown while placing node in diagram
 void renderingChanged()
          Rerenders the fig if needed.
 void setBounds(int x, int y, int w, int h)
          Sets the bounds, but the size will be at least the one returned by getMinimumSize(), unless checking of size is disabled.
 void setEnclosingFig(org.tigris.gef.presentation.Fig encloser)
          Updates the modelelement container if the fig is moved in or out another fig.
 void setFillColor(java.awt.Color lColor)
           
 void setLineColor(java.awt.Color lColor)
           
 void setOperationVisible(boolean isVisible)
           
protected  void textEdited(org.tigris.gef.presentation.FigText ft)
          This method is called after the user finishes editing a text field that is in the FigNodeModelElement.
 void translate(int dx, int dy)
           
protected  CompartmentFigText unhighlight()
           
protected  void updateOperations()
          Updates the operations box.
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, notationAdded, notationChanged, notationProviderAdded, notationProviderRemoved, notationRemoved, paintClarifiers, postLoad, propertyChange, propertySet, recovered, removed, roleAdded, roleRemoved, setItemUID, setOwner, setShadowSize, updateBounds, updateListeners, updateNameText, 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, mousePressed, mouseReleased, paint, removeFigEdge, removePort, setBlinkPorts, setHighlight, showPorts, startTrans, superTranslate, updateEdges
 
Methods inherited from class org.tigris.gef.presentation.FigGroup
addFig, elements, getDisplayedFigs, getFigs, getFillColor, getFilled, getFont, getFontFamily, getFontSize, getLineColor, getLineWidth, getPrivateData, getTextColor, getTextFillColor, getTextFilled, hitFig, isReshapable, isResizable, isRotatable, parseDynObjects, removeAll, removeFig, setFigs, setFilled, setFont, setFontFamily, setFontSize, setLineWidth, 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, getGravityPoints, 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, mousePressed, mouseReleased
 
Methods inherited from interface org.tigris.gef.ui.Highlightable
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

cat

protected static org.apache.log4j.Category cat

_operVec

protected org.tigris.gef.presentation.FigGroup _operVec

The vector of graphics for operations (if any). First one is the rectangle for the entire operations box.


_operBigPort

protected org.tigris.gef.presentation.FigRect _operBigPort

The rectangle for the entire operations box.


_stereoLineBlinder

protected org.tigris.gef.presentation.FigRect _stereoLineBlinder

A rectangle to blank out the line that would otherwise appear at the bottom of the stereotype text box.


resident

public ru.novosoft.uml.foundation.core.MElementResidence resident

Manages residency of an interface within a component on a deployment diagram. Not clear why it is public, or even why it is an instance variable (rather than local to the method).


highlightedFigText

protected CompartmentFigText highlightedFigText

Text highlighted by mouse actions on the diagram.

Constructor Detail

FigInterface

public FigInterface()

Main constructor for a FigInterface.

Parent FigNodeModelElement will have created the main box FigNodeModelElement._bigPort and its name FigNodeModelElement._name and stereotype (@link #_stereo}. This constructor creates a box for the operations.

The properties of all these graphic elements are adjusted appropriately. The main boxes are all filled and have outlines.

For reasons I don't understand the stereotype is created in a box with lines. So we have to created a blanking rectangle to overlay the bottom line, and avoid three compartments showing.

Warning. Much of the graphics positioning is hard coded. The overall figure is placed at location (10,10). The name compartment (in the parent FigNodeModelElement is 21 pixels high. The stereotype compartment is created 15 pixels high in the parent, but we change it to 19 pixels, 1 more than (FigNodeModelElement.STEREOHEIGHT here. The operations box is created at 19 pixels, 2 more than FigNodeModelElement.ROWHEIGHT.

CAUTION: This constructor (with no arguments) is the only one that does enableSizeChecking(false), all others must set it true. This is because this constructor is the only one called when loading a project. In this case, the parsed size must be maintained.


FigInterface

public FigInterface(org.tigris.gef.graph.GraphModel gm,
                    java.lang.Object node)

Constructor for use if this figure is created for an existing interface node in the metamodel.

Set the figure's name according to this node. This is used when the user click's on 'add to diagram' in the navpane. Don't know if this should rather be done in one of the super classes, since similar code is used in FigClass.java etc. Andreas Rueckert <a_rueckert@gmx.net>

Parameters:
gm - Not actually used in the current implementation
node - The UML object being placed.
Method Detail

placeString

public java.lang.String placeString()
Description copied from class: FigNodeModelElement
Reply text to be shown while placing node in diagram

Overrides:
placeString in class FigNodeModelElement

clone

public java.lang.Object clone()

makeSelection

public org.tigris.gef.base.Selection makeSelection()
Overrides:
makeSelection in class FigNodeModelElement

getPopUpActions

public java.util.Vector getPopUpActions(java.awt.event.MouseEvent me)
Build a collection of menu items relevant for a right-click popup menu on an Interface.

Specified by:
getPopUpActions in interface org.tigris.gef.ui.PopupGenerator
Overrides:
getPopUpActions in class FigNodeModelElement
Parameters:
me - a mouse event
Returns:
a collection of menu items

getOperationsFig

public org.tigris.gef.presentation.FigGroup getOperationsFig()

isOperationVisible

public boolean isOperationVisible()
Returns the status of the operation field.

Returns:
true if the operations are visible, false otherwise

setOperationVisible

public void setOperationVisible(boolean isVisible)

getMinimumSize

public java.awt.Dimension getMinimumSize()

Gets the minimum size permitted for an interface on the diagram.

Parts of this are hardcoded, notably the fact that the name compartment has a minimum height of 21 pixels.

Returns:
the size of the minimum bounding box.

setFillColor

public void setFillColor(java.awt.Color lColor)

setLineColor

public void setLineColor(java.awt.Color lColor)

translate

public void translate(int dx,
                      int dy)

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent me)
Description copied from class: FigNodeModelElement
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 java.awt.event.MouseListener
Overrides:
mouseClicked in class FigNodeModelElement

mouseExited

public void mouseExited(java.awt.event.MouseEvent me)

keyPressed

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

setEnclosingFig

public void setEnclosingFig(org.tigris.gef.presentation.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)

textEdited

protected void textEdited(org.tigris.gef.presentation.FigText ft)
                   throws java.beans.PropertyVetoException
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, subclasses should override to handle other text elements.

Overrides:
textEdited in class FigNodeModelElement
Throws:
java.beans.PropertyVetoException

getPreviousVisibleFeature

protected org.tigris.gef.presentation.FigText getPreviousVisibleFeature(org.tigris.gef.presentation.FigText ft,
                                                                        int i)

getNextVisibleFeature

protected org.tigris.gef.presentation.FigText getNextVisibleFeature(org.tigris.gef.presentation.FigText ft,
                                                                    int i)

createFeatureIn

protected void createFeatureIn(org.tigris.gef.presentation.FigGroup fg,
                               java.awt.event.InputEvent ie)
Overrides:
createFeatureIn in class FigNodeModelElement

unhighlight

protected CompartmentFigText unhighlight()

modelChanged

protected void modelChanged(ru.novosoft.uml.MElementEvent mee)
Description copied from class: FigNodeModelElement
This is called aftern 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

renderingChanged

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

Overrides:
renderingChanged in class FigNodeModelElement

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)

Sets the bounds, but the size will be at least the one returned by getMinimumSize(), unless checking of size is disabled.

If the required height is bigger, then the additional height is equally distributed among all figs (i.e. compartments), such that the cumulated height of all visible figs equals the demanded height

.

Some of this has "magic numbers" hardcoded in. In particular there is a knowledge that the minimum height of a name compartment is 21 pixels.

Parameters:
x - Desired X coordinate of upper left corner
y - Desired Y coordinate of upper left corner
w - Desired width of the FigInterface
h - Desired height of the FigInterface

updateOperations

protected void updateOperations()
Updates the operations box. Called from modelchanged if there is a modelevent effecting the attributes and from renderingChanged in all cases.


updateStereotypeText

protected void updateStereotypeText()
Description copied from class: FigNodeModelElement
Updates the text of the sterotype FigText. Override in subclasses to get wanted behaviour. TODO remove all 'misuses' of the stereotype figtexts (like in FigInterface)

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


ArgoUML © 1996-2003 (20030829)ArgoUML Project HomeArgoUML Cookbook