|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.AbstractListModel | +--org.argouml.uml.ui.UMLModelElementListModel | +--org.argouml.uml.ui.UMLModelElementListLinkModel
An abstract list model which allows linking to existing artifacts in the UML model.
In addition to the menu associated with UMLModelElementListModel (Open, Add, Delete, Move Up, Move Down), this also provides a "Link" menu entry, with sub-entries which are valid existing entries that may be linked to.
For the "Link" sub-list, we divide the entries in to two categories, those that make good semantic sense, and those that make only syntactic sense. If both groups exist, the two are separated by a line in the list.
For example in an extension point list for an extend relationship, it is only semantically valid to link to extension points whose owning use case is the same as the base use case of the extend relationship. However syntactically we can link to any extension point.
Within the spirit of ArgoUML we still permit the latter, since it may be convenient while in the middle of a major edit/reorganisation of a model. It will be the responsibility of a critic to point out he flaw.
The constructor is parameterised to allow the link entry to be disabled
(in which case there is no functional difference from the base
UMLModelElementListModel
).
Field Summary | |
protected int |
INVALID_ENTRY
A constant to indicate a potential link menu entry is not valid. |
protected int |
SEMANTIC_ENTRY
A constant to indicate a potential link menu entry makes semantic (as well as syntactic) sense. |
protected int |
SYNTACTIC_ENTRY
A constant to indicate a potential link menu entry makes syntactic (but not semantic) sense. |
Fields inherited from class org.argouml.uml.ui.UMLModelElementListModel |
_upper |
Fields inherited from class javax.swing.AbstractListModel |
listenerList |
Constructor Summary | |
UMLModelElementListLinkModel(UMLUserInterfaceContainer container,
java.lang.Class elementType,
boolean showNone,
boolean useLink)
Create a new list model, with the "Link" sub-menu enabled or disabled according to a supplied flag. Implementation is just an invocation of the parent constructor and a setting of the flag. |
Method Summary | |
boolean |
buildPopup(javax.swing.JPopupMenu popup,
int index)
Override the popup in UMLModelElementListModel , to add
(optionally) a new entry, "Link" with sub-menu entries allowing the
selection of existing model elements.
Note. |
boolean |
buildSubPopup(javax.swing.JMenu submenu,
int index)
Build a sub-menu of existing extension points for the "Link" menu. We make two collections, first of the elements which are valid both syntactically and semantically, secondly of elements which are only syntactically valid. |
void |
collectElements(ru.novosoft.uml.foundation.core.MNamespace ns,
java.util.List semanticList,
java.util.List syntacticList)
Collect all the elements that may appear on the sub-menu list. The implementation considers i) elements in the model, and ii) the standard elements in the profile. |
protected int |
isAcceptable(ru.novosoft.uml.foundation.core.MModelElement me)
The routine to determine if a "Link" sub-menu entry is valid. We give an implementation, rather than declaring as abstract, so a sub-class that disables the "Link" menu need not provide an implementation. |
protected void |
setUseLink(boolean useLink)
Accessor function to set the #_useLink flag value. |
protected boolean |
useLink()
Accessor function to get the #_useLink flag value. |
Methods inherited from class org.argouml.uml.ui.UMLModelElementListModel |
addAtUtil, delete, elementAtUtil, formatElement, getContainer, getContextNotation, getElementAt, getModelElementAt, getModelElementSize, getProperty, getSize, getTarget, getUpperBound, listRoleItemSet, moveDownUtil, moveUpUtil, navigateTo, open, propertySet, recalcModelElementSize, recovered, removed, resetSize, roleAdded, roleRemoved, setUpperBound, targetChanged, targetReasserted |
Methods inherited from class javax.swing.AbstractListModel |
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListeners, removeListDataListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final int SEMANTIC_ENTRY
A constant to indicate a potential link menu entry makes semantic (as well as syntactic) sense.
protected final int SYNTACTIC_ENTRY
A constant to indicate a potential link menu entry makes syntactic (but not semantic) sense.
protected final int INVALID_ENTRY
A constant to indicate a potential link menu entry is not valid.
Constructor Detail |
public UMLModelElementListLinkModel(UMLUserInterfaceContainer container, java.lang.Class elementType, boolean showNone, boolean useLink)
Create a new list model, with the "Link" sub-menu enabled or disabled according to a supplied flag.
Implementation is just an invocation of the parent constructor and a setting of the flag.
container
- The container for this list—the use case
or extend property panel.elementType
- The element type of entries in the Link menu entry.showNone
- true
if an empty list is represented by
the keyword "none", false
otherwise.useLink
- true
if the "Link" menu should be
shown, false
otherwise.Method Detail |
protected boolean useLink()
Accessor function to get the #_useLink
flag value.
#_useLink
flag.protected void setUseLink(boolean useLink)
Accessor function to set the #_useLink
flag value.
public boolean buildPopup(javax.swing.JPopupMenu popup, int index)
Override the popup in UMLModelElementListModel
, to add
(optionally) a new entry, "Link" with sub-menu entries allowing the
selection of existing model elements.
Note. The "Link" entry will only appear if the {#_useLink} flag has been set. Its entries are divided into those that meet both syntactic and semantic rules of UML modelling and those that meet only syntactic rules, with a separator between.
Usual rules apply. No "Open" if there is no entry, no "Add" if we have reached the limit (not anticipated for UMLExtensionPointListModel, but could happen for subclasses), no "Delete" if there is nothing to be deleted, and "Move Up" and "Move Down" only if they make sense.
The "Link" entry appears after "Add" and is greyed out if there are
entries in it. The validation of model element entries to appear on
the menu is through the isAcceptable(ru.novosoft.uml.foundation.core.MModelElement)
method, which must be
provided. They are formatted by the UMLModelElementListModel.formatElement(ru.novosoft.uml.foundation.core.MModelElement)
method,
which may be overridden.
If the "Link" menu is enabled, a link method must be provided, which takes two arguments, the index of the element in the main list on which the pop-up was invoked (as for the other action methods), and the modelElement in the link sub-menu.
This method may be overridden to provide a different type of popup menu if desired.
buildPopup
in class UMLModelElementListModel
popup
- popup menuindex
- index of selected list item on which this popUp is being
invoked.true
if popup menu should be displayed,
false
otherwise. In the current
implementation we always return true
.public boolean buildSubPopup(javax.swing.JMenu submenu, int index)
Build a sub-menu of existing extension points for the "Link" menu.
We make two collections, first of the elements which are valid both syntactically and semantically, secondly of elements which are only syntactically valid. If both groups have members, then they are shown separated by a horizontal bar on the sub-menu.
The method may be overridden to provide a different sort of sub-menu.
popup
- popup menu to use for the sub-menuindex
- index of selected list item on which this sub-popUp is
being invoked.true
if popup sub-menu has any entries, and
should be displayed, false
otherwise.public void collectElements(ru.novosoft.uml.foundation.core.MNamespace ns, java.util.List semanticList, java.util.List syntacticList)
Collect all the elements that may appear on the sub-menu list.
The implementation considers i) elements in the model, and ii) the standard elements in the profile. Eventually this second should be a configurable option.
ns
- semanticList
- The list of elements that are semantically and
syntactically valid.syntacticList
- The list of elements that are only syntactically
valid.protected int isAcceptable(ru.novosoft.uml.foundation.core.MModelElement me)
The routine to determine if a "Link" sub-menu entry is valid.
We give an implementation, rather than declaring as abstract, so a sub-class that disables the "Link" menu need not provide an implementation. Note. If used this default implementation declares all entries invalid, so the "Link" menu will appear but be disabled.
The routine should return one of the three predefined constants, {#SEMANTIC_ENTRY}, {#SYNTACTIC_ENTRY} or {#INVALID_ENTRY}, according to whether the given model element is valid i) semantically and syntactically , ii) only syntactically or iii) not valid at all.
me
- The MModelElement
to test.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML (c) 1996-2002 |