|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--FigNode | +--org.argouml.uml.diagram.ui.FigNodeModelElement | +--org.argouml.uml.diagram.static_structure.ui.FigClass
Class to display graphics for a UML Class in a diagram.
Field Summary | |
---|---|
protected FigRect |
_attrBigPort
The rectangle for the entire attribute box. |
protected FigGroup |
_attrVec
The vector of graphics for attributes (if any). |
private boolean |
_newlyCreated
Flag to indicate that we have just been created. |
protected FigRect |
_operBigPort
The rectangle for the entire operations box. |
protected FigGroup |
_operVec
The vector of graphics for operations (if any). |
protected FigRect |
_stereoLineBlinder
A rectangle to blank out the line that would otherwise appear at the bottom of the stereotype text box. |
private Logger |
cat
|
protected CompartmentFigText |
highlightedFigText
Text highlighted by mouse actions on the diagram. |
Fields inherited from class org.argouml.uml.diagram.ui.FigNodeModelElement |
---|
_bigPort, _enclosedFigs, _encloser, _name, _readyToEdit, _shadowSize, _stereo, BUNDLE, checkSize, ITALIC_LABEL_FONT, LABEL_FONT, MARGIN, POPUP_ADD_OFFSET, ROWHEIGHT, SHADOW_COLOR_ALPHA, SHADOW_COLOR_VALUE, STEREOHEIGHT, suppressCalcBounds |
Constructor Summary | |
---|---|
FigClass()
Main constructor for a FigClass . |
|
FigClass(GraphModel gm,
java.lang.Object node)
Constructor for use if this figure is created for an existing class node in the metamodel. |
Method Summary | |
---|---|
java.lang.Object |
clone()
|
protected void |
createFeatureIn(FigGroup fg,
java.awt.event.InputEvent ie)
|
FigGroup |
getAttributesFig()
|
java.awt.Dimension |
getMinimumSize()
Gets the minimum size permitted for a class on the diagram. |
protected FigText |
getNextVisibleFeature(FigGroup fgVec,
FigText ft,
int i)
|
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 a Package. |
protected FigText |
getPreviousVisibleFeature(FigGroup fgVec,
FigText ft,
int i)
|
boolean |
isAttributeVisible()
Returns the status of the attribute field. |
boolean |
isOperationVisible()
Returns the status of the operation field. |
void |
keyPressed(java.awt.event.KeyEvent ke)
|
Selection |
makeSelection()
|
protected void |
modelChanged(MElementEvent mee)
Handles changes of the model. |
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 |
setAttributeVisible(boolean isVisible)
|
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 |
setFillColor(java.awt.Color lColor)
|
void |
setLineColor(java.awt.Color lColor)
|
void |
setOperationVisible(boolean isVisible)
|
protected void |
textEdited(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 |
updateAbstract()
Updates the name if modelchanged receives an "isAbstract" event |
protected void |
updateAttributes()
Updates the attributes in the fig. |
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 |
updateOperations()
Updates the operations box. |
protected void |
updateStereotypeText()
Updates the text of the sterotype FigText. |
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 |
Field Detail |
private Logger cat
protected FigGroup _attrVec
The vector of graphics for attributes (if any). First one is the rectangle for the entire attributes box.
protected FigGroup _operVec
The vector of graphics for operations (if any). First one is the rectangle for the entire operations box.
protected FigRect _attrBigPort
The rectangle for the entire attribute box.
protected FigRect _operBigPort
The rectangle for the entire operations box.
protected FigRect _stereoLineBlinder
A rectangle to blank out the line that would otherwise appear at the bottom of the stereotype text box.
protected CompartmentFigText highlightedFigText
Text highlighted by mouse actions on the diagram.
private boolean _newlyCreated
Flag to indicate that we have just been created. This is to fix the problem with loading classes that have stereotypes already defined.
Constructor Detail |
public FigClass()
Main constructor for a FigClass
.
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 attributes and
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 four compartments showing.
There is some complex logic to allow for the possibility that stereotypes may not be displayed (unlike operations and attributes this is not a standard thing for UML). Some care is needed to ensure that additional space is not added, each time a stereotyped class is loaded.
There is a particular problem when loading diagrams with stereotyped classes. Because we create a FigClass indicating the stereotype is not displayed, we then add extra space for such classes when they are first rendered. This ought to be fixed by correctly saving the class dimensions, but that needs more work. The solution here is to use a simple flag to indicate the FigClass has just been created.
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
attribute and operations boxes are 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.
public FigClass(GraphModel gm, java.lang.Object node)
Constructor for use if this figure is created for an existing class 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 FigInterface.java etc. Andreas Rueckert <a_rueckert@gmx.net>
gm
- Not actually used in the current implementationnode
- The UML object being placed.Method Detail |
public java.lang.String placeString()
FigNodeModelElement
placeString
in class FigNodeModelElement
public java.lang.Object clone()
public Selection makeSelection()
makeSelection
in class FigNodeModelElement
public java.util.Vector getPopUpActions(java.awt.event.MouseEvent me)
getPopUpActions
in class FigNodeModelElement
me
- a mouse event
public FigGroup getOperationsFig()
public FigGroup getAttributesFig()
public boolean isOperationVisible()
public boolean isAttributeVisible()
public void setAttributeVisible(boolean isVisible)
public void setOperationVisible(boolean isVisible)
public java.awt.Dimension getMinimumSize()
Gets the minimum size permitted for a class on the diagram.
Parts of this are hardcoded, notably the fact that the name compartment has a minimum height of 21 pixels.
public void setFillColor(java.awt.Color lColor)
public void setLineColor(java.awt.Color lColor)
public void translate(int dx, int dy)
public void mouseExited(java.awt.event.MouseEvent me)
public void keyPressed(java.awt.event.KeyEvent ke)
keyPressed
in interface java.awt.event.KeyListener
keyPressed
in class FigNodeModelElement
protected void textEdited(FigText ft) throws java.beans.PropertyVetoException
FigNodeModelElement
textEdited
in class FigNodeModelElement
java.beans.PropertyVetoException
protected FigText getPreviousVisibleFeature(FigGroup fgVec, FigText ft, int i)
protected FigText getNextVisibleFeature(FigGroup fgVec, FigText ft, int i)
protected void createFeatureIn(FigGroup fg, java.awt.event.InputEvent ie)
createFeatureIn
in class FigNodeModelElement
protected CompartmentFigText unhighlight()
protected void modelChanged(MElementEvent mee)
modelChanged
in class FigNodeModelElement
FigNodeModelElement.modelChanged(MElementEvent)
protected void updateStereotypeText()
FigNodeModelElement
updateStereotypeText
in class FigNodeModelElement
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.
x
- Desired X coordinate of upper left cornery
- Desired Y coordinate of upper left cornerw
- Desired width of the FigClassh
- Desired height of the FigClasspublic void mouseClicked(java.awt.event.MouseEvent me)
FigNodeModelElement
mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class FigNodeModelElement
MouseListener.mouseClicked(java.awt.event.MouseEvent)
protected void updateAttributes()
protected void updateOperations()
public void renderingChanged()
FigNodeModelElement
renderingChanged
in class FigNodeModelElement
FigNodeModelElement.renderingChanged()
protected void updateNameText()
FigNodeModelElement
updateNameText
in class FigNodeModelElement
FigNodeModelElement.updateNameText()
protected void updateAbstract()
protected void updateListeners(java.lang.Object newOwner)
FigNodeModelElement
updateListeners
in class FigNodeModelElement
newOwner
- FigNodeModelElement.updateListeners(Object)
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20040306) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |