|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.AbstractListModel | +--org.argouml.uml.ui.UMLComboBoxModel
UMLComboBoxModel2
,
this class is part of the 'old'(pre 0.13.*) implementation of proppanels
that used reflection a lot.
A model for use with drop down combo boxes. Used to supply the correct model for the "type" and "stereotype" drop downs used on several of the property panels, as well as others.
Warning. This is implemented by TreeSet
, a set class,
that therefore does not permit duplicates. If two entries in the drop down
have the same fully qualified name, then they will appear only once in the
list. This causes problems for example with lists of objects in diagrams,
where default naming means newly created objects have the same name.
Field Summary | |
protected boolean |
_addElementsFromProfileModel
Deprecated. Flag to indicate that the drop down should include elements from the model included within the profile. |
protected boolean |
_allowVoid
Deprecated. Flag to indicate that an empty entry should be included (first) in the drop down list. |
protected UMLUserInterfaceContainer |
_container
Deprecated. The container (PropPanel) in which we are used. |
protected java.lang.reflect.Method |
_filter
Deprecated. A method returning a boolean, to indicate whether a specific MModelElement should be allowed in the combo box. |
protected java.lang.reflect.Method |
_getMethod
Deprecated. A method which gets the specific value currently associated with this combo box (the selected value) from the target NSUML object associated with the container. |
protected java.lang.String |
_property
Deprecated. The name of the NSUML event that affects our data model. |
protected java.lang.Object |
_selectedItem
Deprecated. The currently selected object in the combo box (displayed when the drop-down is not being shown). |
protected java.util.TreeSet |
_set
Deprecated. The set of objects that are displayed in the drop down. |
protected java.lang.reflect.Method |
_setMethod
Deprecated. A method which sets the specific value currently associated with this combo box (the selected value) in the target NSUML object associated with the container. |
protected static Category |
cat
Deprecated. |
Fields inherited from class javax.swing.AbstractListModel |
listenerList |
Constructor Summary | |
UMLComboBoxModel(UMLUserInterfaceContainer container,
java.lang.String filter,
java.lang.String property,
java.lang.String getMethod,
java.lang.String setMethod,
boolean allowVoid,
java.lang.Class elementType,
boolean addElementsFromProfileModel)
Deprecated. This method creates a UMLComboBoxModel. |
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent event)
Deprecated. Called when an "action" is performed. |
protected boolean |
addElementsFromProfileModel()
Deprecated. Return a flag indicating if elements from the model associated with the profile are also to be used in the drop down. |
protected boolean |
allowVoid()
Deprecated. Return a flag indicating if the drop down should have an empty entry (as first element). |
void |
collectElements(MNamespace ns,
Profile profile,
boolean isPhantom)
Deprecated. A method to run over the current model (or part thereof), collecting all elements that meet the criteria of the filter method. |
void |
deleteElement(MModelElement removedElement)
Deprecated. Remove an entry if it is currently in the drop down. |
protected UMLUserInterfaceContainer |
getContainer()
Deprecated. Return the container (PropPanel) in which this combo box is used. |
java.lang.Object |
getElementAt(int index)
Deprecated. Provide the element at a specific index in the drop down list. |
protected java.lang.reflect.Method |
getGetMethod()
Deprecated. Return the method of the container, which is used to get the NSUML element associated with this comb box. |
java.lang.Object |
getSelectedItem()
Deprecated. Get the selected item. |
protected java.util.TreeSet |
getSet()
Deprecated. Return the sorted set of elements that are shown in the drop down of the combo box. |
protected java.lang.reflect.Method |
getSetMethod()
Deprecated. Return the method of the container, which is used to set the NSUML element associated with this comb box. |
int |
getSize()
Deprecated. Return the number of elements in the drop down list. |
void |
listRoleItemSet(MElementEvent event)
Deprecated. Invoked if a listened to NSUML element has an entry changed in a component with multiplicity. |
void |
propertySet(MElementEvent event)
Deprecated. Invoked if a listened to NSUML object has an entry without multiplicity set (or an entry with multiplicity completely reset. |
void |
recovered(MElementEvent event)
Deprecated. Invoked if a listened to NSUML element has been restored (by an NSUML internal method), having been removed. |
void |
removed(MElementEvent event)
Deprecated. Invoked if a listened to NSUML element is deleted. |
void |
roleAdded(MElementEvent event)
Deprecated. Invoked if a listened to NSUML element has an entry added to a component with multiplicity. |
void |
roleRemoved(MElementEvent event)
Deprecated. Invoked if a listened to NSUML element has an entry removed from a component with multiplicity. |
void |
setSelectedItem(java.lang.Object selection)
Deprecated. Set the given item as the selected item. |
void |
targetChanged()
Deprecated. Invoked when the target associated with the container is changed. |
void |
targetReasserted()
Deprecated. Called when navigation may have changed. |
void |
updateElement(MModelElement addedElement)
Deprecated. Check that an entry is in the set for the drop down, and add it if it is not. |
Methods inherited from class javax.swing.AbstractListModel |
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.ListModel |
addListDataListener, removeListDataListener |
Field Detail |
protected static Category cat
protected UMLUserInterfaceContainer _container
The container (PropPanel) in which we are used.
protected java.lang.String _property
The name of the NSUML event that affects our data model.
protected java.lang.reflect.Method _filter
A method returning a boolean, to indicate whether a specific MModelElement
should be allowed in the combo box. If the method is
non-existent has the value null
.
protected java.lang.reflect.Method _getMethod
A method which gets the specific value currently associated with
this combo box (the selected value) from the target NSUML object
associated with the container. Returns a MModelElement
. If
the method is non-existent has the value null
.
protected java.lang.reflect.Method _setMethod
A method which sets the specific value currently associated with
this combo box (the selected value) in the target NSUML object
associated with the container. Takes a MModelElement
as
argument. If the method is non-existent has the value
null
.
protected java.util.TreeSet _set
The set of objects that are displayed in the drop down.
protected java.lang.Object _selectedItem
The currently selected object in the combo box (displayed when the drop-down is not being shown).
protected boolean _allowVoid
Flag to indicate that an empty entry should be included (first) in the drop down list.
protected boolean _addElementsFromProfileModel
Constructor Detail |
public UMLComboBoxModel(UMLUserInterfaceContainer container, java.lang.String filter, java.lang.String property, java.lang.String getMethod, java.lang.String setMethod, boolean allowVoid, java.lang.Class elementType, boolean addElementsFromProfileModel)
This method creates a UMLComboBoxModel.
container
- The container (PropPanel) that
contains the ComboBox and provides
access to target, formatting etc.filter
- Name of method on container that
takes a MModelElement
and
returns true
if the
element should be in the combo box
list, false
otherwise. Note. The
supplied model element may be
null
.property
- Name of the NSUML event that would
indicate that the selected value for
the combo box has changed.getMethod
- Name of a method of the container
which will get the value associated
with this combo box. Returns an
object of type
elementType
(see
below).allowVoid
- A flag to indicate that the drop
down list should include (in first
position) an empty entry.elementType
- The base type for all elements in
the combo box.addElementsFromProfileModel
- A flag to indicate that elements
from the model associated with the
profile should be included in the
drop down list.Method Detail |
protected java.util.TreeSet getSet()
Return the sorted set of elements that are shown in the drop down of the combo box.
protected boolean addElementsFromProfileModel()
Return a flag indicating if elements from the model associated with the profile are also to be used in the drop down.
true
if elements should be used from the model
associated with the profile, false
otherwise.protected UMLUserInterfaceContainer getContainer()
Return the container (PropPanel) in which this combo box is used.
protected boolean allowVoid()
Return a flag indicating if the drop down should have an empty entry (as first element).
true
if the drop down should have an empty entry,
false
otherwise.protected java.lang.reflect.Method getGetMethod()
Return the method of the container, which is used to get the NSUML element associated with this comb box.
null
if no method is provided.protected java.lang.reflect.Method getSetMethod()
Return the method of the container, which is used to set the NSUML element associated with this comb box.
null
if no method is provided.public void setSelectedItem(java.lang.Object selection)
Set the given item as the selected item.
Provided to comply with the ComboBoxModel
interface.
setSelectedItem
in interface javax.swing.ComboBoxModel
selection
- The object that should be used as the selected item in
the combo box.public java.lang.Object getSelectedItem()
Get the selected item.
Provided to comply with the ComboBoxModel
interface.
getSelectedItem
in interface javax.swing.ComboBoxModel
public int getSize()
Return the number of elements in the drop down list.
Provided to comply with the ListModel
interface (the parent
of ComboBoxModel
).
getSize
in interface javax.swing.ListModel
public java.lang.Object getElementAt(int index)
Provide the element at a specific index in the drop down list.
Provided to comply with the ListModel
interface (the parent
of ComboBoxModel
).
getElementAt
in interface javax.swing.ListModel
index
- The index of the desired element.
null
if index
exceeds the number of elements in the set.public void collectElements(MNamespace ns, Profile profile, boolean isPhantom)
A method to run over the current model (or part thereof), collecting all elements that meet the criteria of the filter method.
Find all the elements in the namespace supplied. Then recurse on any
of those elements that are themselves namespaces. The result is built
up in _set
.
ns
- The namespace of the model (or part of the model) we
are to examine.profile
- The profile to be used for additional elements and
supplying formatting methods.isPhantom
- A flag which seems to indicate an entry that should
not normally be displayed. This is typically used for
entries in the profile model, which are only displayed
when they start being used in the "real" model. A
combo box entry is created for these, but they are not
added to the set if there is already an element with
the same "short" (i.e. formatted) name.public void targetChanged()
Invoked when the target associated with the container is changed.
Recompute the membership of the drop down and its selected component.
Provided to comply with the UMLUserInterfaceComponent
interface.
targetChanged
in interface UMLUserInterfaceComponent
public void targetReasserted()
Called when navigation may have changed.
Null implementation provided here.
Provided to comply with the UMLUserInterfaceComponent
interface.
targetReasserted
in interface UMLUserInterfaceComponent
public void updateElement(MModelElement addedElement)
Check that an entry is in the set for the drop down, and add it if it is not.
Used to support the NSUML roleAdded event, where an element is added to the namespace.
addedElement
- The model element that should be in the set (if it
has an acceptable type).public void deleteElement(MModelElement removedElement)
Remove an entry if it is currently in the drop down.
Used to support the NSUML roleRemoved event, where an element is removed from the namespace.
removedElement
- The model element that should no longer be in the
set (if it is currently there).public void roleAdded(MElementEvent event)
Invoked if a listened to NSUML element has an entry added to a component with multiplicity.
We are only interested in the "ownedElement" event name, which indicates an object has been added to a namespace.
Provided for compliance with the MElementListener
interface.
public void roleRemoved(MElementEvent event)
Invoked if a listened to NSUML element has an entry removed from a component with multiplicity.
We're only interested in the case where the name is "ownedElement", indicating an element has been removed from the namespace.
Provided for compliance with the MElementListener
interface.
event
- The event which triggered this method.public void recovered(MElementEvent event)
Invoked if a listened to NSUML element has been restored (by an NSUML internal method), having been removed.
Null implementation in this case.
Provided for compliance with the MElementListener
interface.
event
- The event which triggered this method.public void listRoleItemSet(MElementEvent event)
Invoked if a listened to NSUML element has an entry changed in a component with multiplicity.
Null implementation in this case.
Provided for compliance with the MElementListener
interface.
event
- The event which triggered this method.public void removed(MElementEvent event)
Invoked if a listened to NSUML element is deleted.
We must remove it from the set if it is there.
Provided for compliance with the MElementListener
interface.
event
- The event which triggered this method.public void propertySet(MElementEvent event)
Invoked if a listened to NSUML object has an entry without multiplicity set (or an entry with multiplicity completely reset.
We are interested in changes to "name" fields, since they may appear in our set.
Warning. This only works if setNameEventListener is enabled to listen for name changes on NSUML elements other than the target.
Provided for compliance with the MElementListener
interface.
event
- The event which triggered this method.public void actionPerformed(java.awt.event.ActionEvent event)
Called when an "action" is performed.
Called when a new selected item is chosen from the drop down list. We try to set the associated model element accordingly.
Provided to comply with the ActionListener
interface, which
provides for general listening support.
actionPerformed
in interface java.awt.event.ActionListener
event
- The event that triggered us.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2003 (20030919) | ArgoUML Project Home | ArgoUML Cookbook |