org.argouml.uml.diagram.ui
Class FigNodeModelElement

java.lang.Object
  |
  +--FigNode
        |
        +--org.argouml.uml.diagram.ui.FigNodeModelElement
All Implemented Interfaces:
ArgoEventListener, ArgoNotationEventListener, DelayedVChangeListener, java.util.EventListener, java.awt.event.KeyListener, java.awt.event.MouseListener, NotationContext, java.beans.PropertyChangeListener, java.beans.VetoableChangeListener
Direct Known Subclasses:
FigActor, FigClass, FigClassifierRole, FigComment, FigComponent, FigComponentInstance, FigInstance, FigInterface, FigMessage, FigMNode, FigMNodeInstance, FigNote, FigObject, FigPackage, FigSeqObject, FigSeqStimulus, FigStateVertex, FigUseCase

public abstract class FigNodeModelElement
extends FigNode
implements java.beans.VetoableChangeListener, DelayedVChangeListener, java.awt.event.MouseListener, java.awt.event.KeyListener, java.beans.PropertyChangeListener, NotationContext, ArgoNotationEventListener

Abstract class to display diagram icons for UML ModelElements that look like nodes and that have editiable names and can be resized.

See Also:
Serialized Form

Field Summary
protected  FigRect _bigPort
           
protected  java.util.Vector _enclosedFigs
           
protected  Fig _encloser
           
 FigText _name
           
protected  boolean _readyToEdit
           
 int _shadowSize
           
 FigText _stereo
           
protected  boolean checkSize
           
static java.awt.Font ITALIC_LABEL_FONT
           
static java.awt.Font LABEL_FONT
           
 int MARGIN
           
protected static int ROWHEIGHT
           
protected static int STEREOHEIGHT
           
protected  boolean suppressCalcBounds
           
 
Constructor Summary
FigNodeModelElement()
           
FigNodeModelElement(GraphModel gm, java.lang.Object node)
          Partially construct a new FigNode.
 
Method Summary
 void calcBounds()
           
protected  void createFeatureIn(FigGroup fg, java.awt.event.InputEvent me)
           
 void damage()
           
 void delayedVetoableChange(java.beans.PropertyChangeEvent pce)
           
 void delete()
           
 void dispose()
           
 void elementOrdering(java.util.Vector figures)
          Update the order of this fig and the order of the figs that are inside of this fig
 void enableSizeChecking(boolean flag)
           
 void finalize()
           
 NotationName getContextNotation()
          Returns the notation name for this fig.
 java.util.Vector getEnclosedFigs()
           
 Fig getEnclosingFig()
           
 ItemUID getItemUID()
           
 FigText getNameFig()
           
 java.util.Vector getPopUpActions(java.awt.event.MouseEvent me)
           
 int getShadowSize()
           
 java.lang.String getTipString(java.awt.event.MouseEvent me)
           
protected  java.awt.Dimension getUpdatedSize(FigGroup fg, int x, int y, int w, int h)
          returns the new size of the FigGroup (either attributes or operations) after calculation new bounds for all sub-figs, considering their minimal sizes; FigGroup need not be displayed; no update event is fired
 boolean hit(java.awt.Rectangle r)
          Necessary since GEF contains some errors regarding the hit subject.
 ToDoItem hitClarifier(int x, int y)
           
protected  boolean isPartlyOwner(Fig fig, java.lang.Object o)
           
protected  boolean isPartlyOwner(java.lang.Object o)
           
 void keyPressed(java.awt.event.KeyEvent ke)
           
 void keyReleased(java.awt.event.KeyEvent ke)
          not used, do nothing.
 void keyTyped(java.awt.event.KeyEvent ke)
           
 void listRoleItemSet(MElementEvent mee)
           
 Selection makeSelection()
           
protected  void modelChanged(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 notationAdded(ArgoNotationEvent event)
          Invoked when a notation has been added.
 void notationChanged(ArgoNotationEvent event)
          Invoked when any aspect of the notation has been changed.
 void notationProviderAdded(ArgoNotationEvent event)
          Invoked when a notation provider has been added.
 void notationProviderRemoved(ArgoNotationEvent event)
          Invoked when a notation provider has been removed.
 void notationRemoved(ArgoNotationEvent event)
          Invoked when a notation has been removed.
 void paintClarifiers(java.awt.Graphics g)
          Displays visual indications of pending ToDoItems.
 java.lang.String placeString()
          Reply text to be shown while placing node in diagram
 void postLoad()
           
 void propertyChange(java.beans.PropertyChangeEvent pve)
           
 void propertySet(MElementEvent mee)
           
 void recovered(MElementEvent mee)
           
 void removed(MElementEvent mee)
           
 void renderingChanged()
          Rerenders the fig if needed.
 void roleAdded(MElementEvent mee)
           
 void roleRemoved(MElementEvent mee)
           
 void setEnclosingFig(Fig encloser)
          Updates the modelelement container if the fig is moved in or out another fig.
 void setItemUID(ItemUID id)
           
 void setOwner(java.lang.Object own)
           
 void setShadowSize(int size)
           
protected  void textEdited(FigText ft)
          This method is called after the user finishes editing a text field that is in the FigNodeModelElement.
protected  void updateBounds()
           
protected  void updateListeners(java.lang.Object newOwner)
          Implementations of this method should register/unregister the fig for all (model)events.
protected  void updateNameText()
          Updates the text of the name FigText.
protected  void updateStereotypeText()
          Updates the text of the sterotype FigText.
 void vetoableChange(java.beans.PropertyChangeEvent pce)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.MouseListener
mouseEntered, mouseExited, mousePressed, mouseReleased
 

Field Detail

LABEL_FONT

public static java.awt.Font LABEL_FONT

ITALIC_LABEL_FONT

public static java.awt.Font ITALIC_LABEL_FONT

MARGIN

public final int MARGIN
See Also:
Constant Field Values

ROWHEIGHT

protected static final int ROWHEIGHT
See Also:
Constant Field Values

STEREOHEIGHT

protected static final int STEREOHEIGHT
See Also:
Constant Field Values

checkSize

protected boolean checkSize

_bigPort

protected FigRect _bigPort

_name

public FigText _name

_stereo

public FigText _stereo

_enclosedFigs

protected java.util.Vector _enclosedFigs

_encloser

protected Fig _encloser

_readyToEdit

protected boolean _readyToEdit

suppressCalcBounds

protected boolean suppressCalcBounds

_shadowSize

public int _shadowSize
Constructor Detail

FigNodeModelElement

public FigNodeModelElement()

FigNodeModelElement

public FigNodeModelElement(GraphModel gm,
                           java.lang.Object node)
Partially construct a new FigNode. This method creates the _name element that holds the name of the model element and adds itself as a listener.

Method Detail

finalize

public void finalize()

placeString

public java.lang.String placeString()
Reply text to be shown while placing node in diagram


setItemUID

public void setItemUID(ItemUID id)

getItemUID

public ItemUID getItemUID()

getNameFig

public FigText getNameFig()

getPopUpActions

public java.util.Vector getPopUpActions(java.awt.event.MouseEvent me)

getEnclosingFig

public Fig getEnclosingFig()

setEnclosingFig

public void setEnclosingFig(Fig encloser)
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.

See Also:
org.tigris.gef.presentation.Fig#setEnclosingFig(org.tigris.gef.presentation.Fig)

getEnclosedFigs

public java.util.Vector getEnclosedFigs()

elementOrdering

public void elementOrdering(java.util.Vector figures)
Update the order of this fig and the order of the figs that are inside of this fig


makeSelection

public Selection makeSelection()

paintClarifiers

public void paintClarifiers(java.awt.Graphics g)
Displays visual indications of pending ToDoItems. Please note that the list of advices (ToDoList) is not the same as the list of element known by the FigNode (_figs). Therefore, it is necessary to check if the graphic item exists before drawing on it. See ClAttributeCompartment for an example.

See Also:
ClAttributeCompartment

hitClarifier

public ToDoItem hitClarifier(int x,
                             int y)

getTipString

public java.lang.String getTipString(java.awt.event.MouseEvent me)

vetoableChange

public void vetoableChange(java.beans.PropertyChangeEvent pce)
Specified by:
vetoableChange in interface java.beans.VetoableChangeListener

delayedVetoableChange

public void delayedVetoableChange(java.beans.PropertyChangeEvent pce)
Specified by:
delayedVetoableChange in interface DelayedVChangeListener

updateBounds

protected void updateBounds()

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent pve)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

textEdited

protected void textEdited(FigText ft)
                   throws java.beans.PropertyVetoException
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.

java.beans.PropertyVetoException

mouseClicked

public 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. This allows the user to initiate direct text editing.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

keyPressed

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

keyReleased

public void keyReleased(java.awt.event.KeyEvent ke)
not used, do nothing.

Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent ke)
Specified by:
keyTyped in interface java.awt.event.KeyListener

modelChanged

protected void modelChanged(MElementEvent mee)
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.


createFeatureIn

protected void createFeatureIn(FigGroup fg,
                               java.awt.event.InputEvent me)

propertySet

public void propertySet(MElementEvent mee)

listRoleItemSet

public void listRoleItemSet(MElementEvent mee)

recovered

public void recovered(MElementEvent mee)

removed

public void removed(MElementEvent mee)

isPartlyOwner

protected boolean isPartlyOwner(java.lang.Object o)

isPartlyOwner

protected boolean isPartlyOwner(Fig fig,
                                java.lang.Object o)

roleAdded

public void roleAdded(MElementEvent mee)

roleRemoved

public void roleRemoved(MElementEvent mee)

dispose

public void dispose()

setOwner

public void setOwner(java.lang.Object own)

updateStereotypeText

protected void updateStereotypeText()
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)


updateNameText

protected void updateNameText()
Updates the text of the name FigText.


updateListeners

protected void updateListeners(java.lang.Object newOwner)
Implementations of this method should register/unregister the fig for all (model)events. For FigNodeModelElement only the fig itself is registred 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.

Parameters:
newOwner -

getContextNotation

public NotationName getContextNotation()
Returns the notation name for this fig. First start to implement notations on a per fig basis.

Specified by:
getContextNotation in interface NotationContext
Returns:
null if the context does not wish to name a specific notation
See Also:
NotationContext.getContextNotation()

notationChanged

public void notationChanged(ArgoNotationEvent event)
Description copied from interface: ArgoNotationEventListener
Invoked when any aspect of the notation has been changed.

Specified by:
notationChanged in interface ArgoNotationEventListener

notationAdded

public void notationAdded(ArgoNotationEvent event)
Description copied from interface: ArgoNotationEventListener
Invoked when a notation has been added.

Specified by:
notationAdded in interface ArgoNotationEventListener

notationRemoved

public void notationRemoved(ArgoNotationEvent event)
Description copied from interface: ArgoNotationEventListener
Invoked when a notation has been removed.

Specified by:
notationRemoved in interface ArgoNotationEventListener

notationProviderAdded

public void notationProviderAdded(ArgoNotationEvent event)
Description copied from interface: ArgoNotationEventListener
Invoked when a notation provider has been added.

Specified by:
notationProviderAdded in interface ArgoNotationEventListener

notationProviderRemoved

public void notationProviderRemoved(ArgoNotationEvent event)
Description copied from interface: ArgoNotationEventListener
Invoked when a notation provider has been removed.

Specified by:
notationProviderRemoved in interface ArgoNotationEventListener

renderingChanged

public void renderingChanged()
Rerenders the fig if needed. This functionality was originally the functionality of modelChanged but modelChanged takes the event now into account.


calcBounds

public void calcBounds()

enableSizeChecking

public void enableSizeChecking(boolean flag)

getUpdatedSize

protected java.awt.Dimension getUpdatedSize(FigGroup fg,
                                            int x,
                                            int y,
                                            int w,
                                            int h)
returns the new size of the FigGroup (either attributes or operations) after calculation new bounds for all sub-figs, considering their minimal sizes; FigGroup need not be displayed; no update event is fired


setShadowSize

public void setShadowSize(int size)

getShadowSize

public int getShadowSize()

hit

public boolean hit(java.awt.Rectangle r)
Necessary since GEF contains some errors regarding the hit subject.

See Also:
org.tigris.gef.presentation.Fig#hit(Rectangle)

delete

public void delete()
See Also:
org.tigris.gef.presentation.Fig#delete()

damage

public void damage()
See Also:
org.tigris.gef.presentation.Fig#damage()

postLoad

public void postLoad()
See Also:
org.tigris.gef.presentation.Fig#postLoad()


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