|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectFigEdgePoly
org.argouml.uml.diagram.ui.FigEdgeModelElement
public abstract class FigEdgeModelElement
Abstract class to display diagram lines (edges) for UML ModelElements that look like lines. This Fig is prepared to show a (possibly editable) name, and/or multiple stereotypes.
NOTE: This will drop the ArgoNotationEventListener and ArgoDiagramAppearanceEventListener interfaces in the next release. The corresponding methods have been marked as deprecated.
| Field Summary |
|---|
| Fields inherited from interface org.argouml.uml.diagram.ui.ArgoFig |
|---|
DEBUG, DEBUG_COLOR, FILL_COLOR, INVISIBLE_LINE_COLOR, LINE_COLOR, LINE_WIDTH, ROWHEIGHT, SOLID_FILL_COLOR, STEREOHEIGHT, TEXT_COLOR, X0, Y0 |
| Constructor Summary | |
|---|---|
protected |
FigEdgeModelElement(java.lang.Object element,
DiagramSettings renderSettings)
Construct a new FigEdge. |
| Method Summary | |
|---|---|
protected void |
addElementListener(java.lang.Object element)
Add an element listener and remember the registration. |
protected void |
addElementListener(java.lang.Object element,
java.lang.String property)
Add a listener and remember the registration. |
protected void |
addElementListener(java.lang.Object element,
java.lang.String[] property)
Add a listener and remember the registration. |
protected void |
allowRemoveFromDiagram(boolean allowed)
|
protected boolean |
canEdit(Fig f)
|
void |
damage()
|
void |
delayedVetoableChange(java.beans.PropertyChangeEvent pce)
|
void |
deleteFromModel()
|
protected boolean |
determineFigNodes()
Determines if the FigEdge is currently connected to the correct FigNodes, if not the edges is the correct FigNodes set and the edge rerouted. |
void |
diagramFontChanged(ArgoDiagramAppearanceEvent e)
Deprecated. for 0.27.2 by tfmorris. Global rendering changes are now managed at the diagram level. |
protected javax.swing.Action[] |
getApplyStereotypeActions()
Get the set of Actions which valid for adding/removing Stereotypes on the ModelElement of this Fig's owner. |
protected java.lang.Object |
getDestination()
Returns the destination of the edge. |
java.lang.Object |
getDestinationConnector()
Get the model element at the destination end of the edge. |
DiElement |
getDiElement()
|
FigEdgePort |
getEdgePort()
|
ItemUID |
getItemUID()
Getter for the UID |
java.lang.String |
getName()
|
java.awt.Rectangle |
getNameBounds()
Get the Rectangle in which the model elements name is displayed |
protected FigText |
getNameFig()
Getter for name, the name Fig |
protected int |
getNameFigFontStyle()
Determines the font style based on the UML model. |
protected int |
getNotationProviderType()
Overrule this for subclasses that need a different NotationProvider. |
protected NotationSettings |
getNotationSettings()
|
java.util.Vector |
getPopUpActions(java.awt.event.MouseEvent me)
|
protected static int |
getPopupAddOffset()
|
Project |
getProject()
Deprecated. for 0.27.2 by tfmorris. Implementations should have all the information that they require in the DiagramSettings object. |
protected Fig |
getRemoveDelegate()
Subclasses should override this to redirect a remove request from one Fig to another. |
DiagramSettings |
getSettings()
|
protected java.lang.Object |
getSource()
Returns the source of the edge. |
java.lang.Object |
getSourceConnector()
Get the model element at the source end of the edge. |
protected int |
getSquaredDistance(java.awt.Point p1,
java.awt.Point p2)
distance formula: (x-h)^2 + (y-k)^2 = distance^2 |
protected FigStereotypesGroup |
getStereotypeFig()
Getter for stereo, the stereotype Fig |
java.lang.String |
getTipString(java.awt.event.MouseEvent me)
|
boolean |
hit(java.awt.Rectangle r)
|
ToDoItem |
hitClarifier(int x,
int y)
The user clicked on the clarifier. |
protected void |
indicateBounds(FigText f,
java.awt.Graphics g)
This is used to draw a box round the edge of any editable FigText annotations of the edge when the edge is selected. |
protected void |
initNotationProviders(java.lang.Object own)
Replace the NotationProvider(s). |
void |
keyPressed(java.awt.event.KeyEvent ke)
|
void |
keyReleased(java.awt.event.KeyEvent ke)
|
void |
keyTyped(java.awt.event.KeyEvent ke)
|
void |
makeEdgePort()
Create a FigCommentPort if needed |
Selection |
makeSelection()
|
protected void |
modelAssociationAdded(AddAssociationEvent aae)
Called whenever we receive an AddAssociationEvent. |
protected void |
modelAssociationRemoved(RemoveAssociationEvent rae)
Called whenever we receive an RemoveAssociationEvent. |
protected void |
modelAttributeChanged(AttributeChangeEvent ace)
Called whenever we receive an AttributeChangeEvent. |
protected void |
modelChanged(java.beans.PropertyChangeEvent e)
This is called after any part of the UML ModelElement has changed. |
void |
mouseClicked(java.awt.event.MouseEvent me)
|
void |
mouseEntered(java.awt.event.MouseEvent me)
|
void |
mouseExited(java.awt.event.MouseEvent me)
|
void |
mousePressed(java.awt.event.MouseEvent me)
|
void |
mouseReleased(java.awt.event.MouseEvent me)
|
void |
notationAdded(ArgoNotationEvent event)
Deprecated. for 0.27.2 by tfmorris. |
void |
notationChanged(ArgoNotationEvent event)
Deprecated. for 0.27.2 by tfmorris. Changes to notation provider are now handled by the owning diagram. |
void |
notationProviderAdded(ArgoNotationEvent event)
Deprecated. for 0.27.2 by tfmorris. |
void |
notationProviderRemoved(ArgoNotationEvent event)
Deprecated. for 0.27.2 by tfmorris. |
void |
notationRemoved(ArgoNotationEvent event)
Deprecated. for 0.27.2 by tfmorris. |
void |
paintClarifiers(java.awt.Graphics g)
|
void |
propertyChange(java.beans.PropertyChangeEvent pve)
This method gets called when a bound property gets changed. |
protected void |
removeAllElementListeners()
Unregister all listeners registered through addElementListener |
protected void |
removeElementListener(java.lang.Object element)
Add an element listener and remember the registration. |
void |
removeFromDiagram()
|
protected void |
removeFromDiagramImpl()
|
void |
renderingChanged()
Rerenders the attached elements of the fig. |
void |
setDiElement(DiElement element)
Set the associated Diagram Interchange element. |
void |
setFig(Fig f)
|
void |
setItemUID(ItemUID newId)
Setter for the UID |
void |
setLayer(Layer lay)
|
void |
setLineColor(java.awt.Color c)
|
void |
setOwner(java.lang.Object owner)
Deprecated. for 0.27.3 by tfmorris. Set owner in constructor. This method is implemented in GEF, so we'll leave this implementation here to block any attempts to use it within ArgoUML. |
void |
setProject(Project project)
Deprecated. |
void |
setSettings(DiagramSettings renderSettings)
Set the rendering settings to be used for this fig. |
protected void |
showHelp(java.lang.String s)
Utility function to localize the given string with help text, and show it in the status bar of the ArgoUML window. |
protected void |
superRemoveFromDiagram()
|
protected void |
textEdited(FigText ft)
This method is called after the user finishes editing a text field that is in the FigEdgeModelElement. |
protected void |
textEditStarted(FigText ft)
This method is called when the user doubleclicked on the text field, and starts editing. |
protected void |
updateElementListeners(java.util.Set<java.lang.Object[]> listenerSet)
Update the set of registered listeners to match the given set using a minimal update strategy to remove unneeded listeners and add new listeners. |
protected void |
updateFont()
This function should, for all FigTexts, recalculate the font-style (plain, bold, italic, bold/italic), and apply it by calling FigText.setFont(). |
protected void |
updateLayout(UmlChangeEvent event)
This is a template method called by the ArgoUML framework as the result of a change to a model element. |
protected void |
updateListeners(java.lang.Object oldOwner,
java.lang.Object newOwner)
Implementations of this method should register/unregister the fig for all (model)events that may cause a repaint to be necessary. |
protected void |
updateNameText()
generate the notation for the modelelement and stuff it into the text Fig |
protected void |
updateStereotypeText()
generate the notation for the stereotype and stuff it into the text Fig |
void |
vetoableChange(java.beans.PropertyChangeEvent pce)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.argouml.cognitive.Highlightable |
|---|
getHighlight, setHighlight |
| Constructor Detail |
|---|
protected FigEdgeModelElement(java.lang.Object element,
DiagramSettings renderSettings)
This constructor is only intended for use by concrete subclasses.
element - owning uml elementrenderSettings - rendering settings| Method Detail |
|---|
public void makeEdgePort()
public FigEdgePort getEdgePort()
public void setItemUID(ItemUID newId)
setItemUID in interface IItemUIDnewId - the new UIDpublic ItemUID getItemUID()
getItemUID in interface IItemUIDpublic java.lang.String getTipString(java.awt.event.MouseEvent me)
public java.util.Vector getPopUpActions(java.awt.event.MouseEvent me)
me - the MouseEvent that triggered the popup menu request
protected javax.swing.Action[] getApplyStereotypeActions()
protected int getSquaredDistance(java.awt.Point p1,
java.awt.Point p2)
p1 - pointp2 - point
public void paintClarifiers(java.awt.Graphics g)
paintClarifiers in interface Clarifiableg - the Graphics object
protected void indicateBounds(FigText f,
java.awt.Graphics g)
f - the fig to indicate the bounds ofg - the graphics
public ToDoItem hitClarifier(int x,
int y)
x - the x of the point clickedy - the y of the point clicked
public Selection makeSelection()
SelectionRerouteEdge object that manages selection and
rerouting of the edge.org.tigris.gef.presentation.Fig#makeSelection()protected FigText getNameFig()
public java.awt.Rectangle getNameBounds()
public java.lang.String getName()
protected FigStereotypesGroup getStereotypeFig()
public void vetoableChange(java.beans.PropertyChangeEvent pce)
vetoableChange in interface java.beans.VetoableChangeListenerpublic void delayedVetoableChange(java.beans.PropertyChangeEvent pce)
delayedVetoableChange in interface DelayedVChangeListenerpce - the eventpublic void propertyChange(java.beans.PropertyChangeEvent pve)
propertyChange in interface java.beans.PropertyChangeListenerpve - the event containing the property change informationPropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)protected void modelAttributeChanged(AttributeChangeEvent ace)
ace - the eventprotected void modelAssociationAdded(AddAssociationEvent aae)
aae - the eventprotected void modelAssociationRemoved(RemoveAssociationEvent rae)
rae - the eventprotected void updateLayout(UmlChangeEvent event)
Override this in any subclasses in order to restructure the FigNode due to change of any model element that this FigNode is listening to.
This method is guaranteed by the framework to be running on the Swing/AWT thread.
event - the UmlChangeEvent that caused the changeprotected void textEditStarted(FigText ft)
It is also possible to alter the text to be edited already here, e.g. by adding the stereotype in front of the name, but that seems not user-friendly.
ft - the FigText that will be edited and contains the start-textprotected void showHelp(java.lang.String s)
s - the given string to be localized and shownprotected void textEdited(FigText ft)
ft - the text Fig that has been editedprotected boolean canEdit(Fig f)
f - the Fig
public void mousePressed(java.awt.event.MouseEvent me)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent me)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent me)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent me)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent me)
mouseClicked in interface java.awt.event.MouseListenerpublic void keyPressed(java.awt.event.KeyEvent ke)
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent ke)
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent ke)
keyTyped in interface java.awt.event.KeyListenerpublic void renderingChanged()
Warning: The purpose of this function is NOT to redraw the whole Fig every time something changes. That would be inefficient.
Instead, this function should only be called for major changes that require a complete redraw, such as change of owner, and change of notation language.
Overrule this function for subclasses that add extra or remove graphical parts.
renderingChanged in interface ArgoFigprotected void modelChanged(java.beans.PropertyChangeEvent e)
e - the eventprotected void updateNameText()
protected void updateStereotypeText()
protected void initNotationProviders(java.lang.Object own)
This method shall not be used for the initial creation of notation providers, but only for replacing them when required. Initialization must be done in the constructor using methods which can't be overridden.
NotationProviders can not be updated - they are lightweight throw-away objects. Hence this method creates a (new) NotationProvider whenever needed. E.g. when the notation language is changed by the user, then the NPs are to be re-created. So, this method shall not be called from a Fig constructor.
After the removal of the deprecated method setOwner(), this method shall contain the following statement: assert notationProviderName != null
own - the current ownerprotected int getNotationProviderType()
protected void updateListeners(java.lang.Object oldOwner,
java.lang.Object newOwner)
But for, for example, for a FigLink the fig must also register for events fired by the association of the owner - because the name of the association is shown, not the name of the Link.
In other cases, there is no need to register for any event, e.g. when a notationProvider is used.
This function is called in 2 places: at creation (load) time of this Fig, i.e. when the owner changes, and in some cases by the modelChanged() function, i.e. when the model changes.
This function shall always register for the "remove" event of the owner! Otherwise the Fig will not be deleted when the owner gets deleted.
IF this method is called with both the oldOwner and the newOwner equal and not null, AND we listen only to the owner itself, THEN we can safely ignore the call, but ELSE we need to update the listeners of the related elements, since the related elements may have been replaced.
newOwner - the new owner for the listeners,
or null if all listeners have to be removedoldOwner - the previous owner,
or null if there was none, and all listeners have to be setpublic void setLayer(Layer lay)
public void deleteFromModel()
@Deprecated public void notationChanged(ArgoNotationEvent event)
ArgoNotationEventListener
notationChanged in interface ArgoNotationEventListenerevent - ArgoNotationEvent describing the change.ArgoNotationEventListener.notationChanged(org.argouml.application.events.ArgoNotationEvent)@Deprecated public void notationAdded(ArgoNotationEvent event)
ArgoNotationEventListener
notationAdded in interface ArgoNotationEventListenerevent - ArgoNotationEvent describing the added notation.ArgoNotationEventListener.notationAdded(org.argouml.application.events.ArgoNotationEvent)@Deprecated public void notationRemoved(ArgoNotationEvent event)
ArgoNotationEventListener
notationRemoved in interface ArgoNotationEventListenerevent - ArgoNotationEvent describing the removed notation.ArgoNotationEventListener.notationRemoved(org.argouml.application.events.ArgoNotationEvent)@Deprecated public void notationProviderAdded(ArgoNotationEvent event)
ArgoNotationEventListener
notationProviderAdded in interface ArgoNotationEventListenerevent - ArgoNotationEvent describing
the added notation provider.ArgoNotationEventListener.notationProviderAdded(org.argouml.application.events.ArgoNotationEvent)@Deprecated public void notationProviderRemoved(ArgoNotationEvent event)
ArgoNotationEventListener
notationProviderRemoved in interface ArgoNotationEventListenerevent - ArgoNotationEvent describing
the removed notation provider.ArgoNotationEventListener.notationProviderRemoved(org.argouml.application.events.ArgoNotationEvent)public boolean hit(java.awt.Rectangle r)
public final void removeFromDiagram()
protected Fig getRemoveDelegate()
protected void removeFromDiagramImpl()
protected void superRemoveFromDiagram()
public void damage()
protected boolean determineFigNodes()
Determines if the FigEdge is currently connected to the correct FigNodes, if not the edges is the correct FigNodes set and the edge rerouted.
Typically this is used when a user has amended from the property panel a relationship from one model element to another and the graph needs to react to that change.
e.g. if the participant of an association end is changed.
Calls a helper method (layoutThisToSelf) to avoid this edge disappearing if the new source and dest are the same node. TODO: This method is called far too frequently. It should only be called when a specific event is received. It seems to be currently called whenever any event is received from the owner.
protected java.lang.Object getSource()
public java.lang.Object getSourceConnector()
public java.lang.Object getDestinationConnector()
protected java.lang.Object getDestination()
protected void allowRemoveFromDiagram(boolean allowed)
allowed - true if the function RemoveFromDiagram is allowedpublic void setDiElement(DiElement element)
element - the element to be associated with this Figpublic DiElement getDiElement()
protected static int getPopupAddOffset()
protected void addElementListener(java.lang.Object element)
element - element to listen for changes onModelEventPump.addModelEventListener(PropertyChangeListener, Object, String)
protected void addElementListener(java.lang.Object element,
java.lang.String property)
element - element to listen for changes onproperty - name of property to listen for changes ofModelEventPump.addModelEventListener(PropertyChangeListener, Object, String)
protected void addElementListener(java.lang.Object element,
java.lang.String[] property)
element - element to listen for changes onproperty - array of property names (Strings) to listen for changes ofModelEventPump.addModelEventListener(PropertyChangeListener, Object, String)protected void removeElementListener(java.lang.Object element)
element - element to listen for changes onModelEventPump.addModelEventListener(PropertyChangeListener, Object, String)protected void removeAllElementListeners()
addElementListener(Object, String)protected void updateElementListeners(java.util.Set<java.lang.Object[]> listenerSet)
listenerSet - a set of arrays containing a tuple of a UML element
to be listened to and a set of property to be listened for.@Deprecated public void setProject(Project project)
UnsupportedOperationException if used. Figs are
added to a GraphModel which is, in turn, owned by a project.
setProject in interface ArgoFigproject - the project@Deprecated public Project getProject()
ArgoFig
getProject in interface ArgoFigArgoFig.getProject()@Deprecated public void diagramFontChanged(ArgoDiagramAppearanceEvent e)
diagramFontChanged in interface ArgoDiagramAppearanceEventListenere - the eventArgoDiagramAppearanceEventListener.diagramFontChanged(org.argouml.application.events.ArgoDiagramAppearanceEvent)protected void updateFont()
protected int getNameFigFontStyle()
public DiagramSettings getSettings()
getSettings in interface ArgoFigpublic void setSettings(DiagramSettings renderSettings)
ArgoFig
setSettings in interface ArgoFigrenderSettings - the rendering settings to useprotected NotationSettings getNotationSettings()
public void setLineColor(java.awt.Color c)
public void setFig(Fig f)
@Deprecated public void setOwner(java.lang.Object owner)
setOwner in interface ArgoFigowner - owning UML element
java.lang.UnsupportedOperationExceptionorg.tigris.gef.presentation.Fig#setOwner(java.lang.Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
| ArgoUML © 1996-2006 | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |