|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.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. |
private static org.apache.log4j.Logger |
cat
Deprecated. logger |
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(java.lang.Object 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(java.lang.Object 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. |
private boolean |
isAcceptible(java.lang.Object element)
Deprecated. Use the supplied filter method to identify if the supplied model element should be included in the drop down list. |
void |
listRoleItemSet(ru.novosoft.uml.MElementEvent event)
Deprecated. Invoked if a listened to NSUML element has an entry changed in a component with multiplicity. |
void |
propertySet(ru.novosoft.uml.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(ru.novosoft.uml.MElementEvent event)
Deprecated. Invoked if a listened to NSUML element has been restored (by an NSUML internal method), having been removed. |
void |
removed(ru.novosoft.uml.MElementEvent event)
Deprecated. Invoked if a listened to NSUML element is deleted. |
void |
roleAdded(ru.novosoft.uml.MElementEvent event)
Deprecated. Invoked if a listened to NSUML element has an entry added to a component with multiplicity. |
void |
roleRemoved(ru.novosoft.uml.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(java.lang.Object 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 |
private static org.apache.log4j.Logger cat
protected UMLUserInterfaceContainer _container
protected java.lang.String _property
protected java.lang.reflect.Method _filter
MModelElement
should be
allowed in the combo box. If the method is non-existent has the
value null
.
protected java.lang.reflect.Method _getMethod
MModelElement
. If the method
is non-existent has the value null
.
protected java.lang.reflect.Method _setMethod
MModelElement
as argument. If
the method is non-existent has the value null
.
protected java.util.TreeSet _set
protected java.lang.Object _selectedItem
protected boolean _allowVoid
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)
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).setMethod
- Name of a method of the container which will
set the value associated with this combo box. Takes as argument
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()
protected boolean addElementsFromProfileModel()
true
if elements should be used from the model
associated with the profile, false
otherwise.protected UMLUserInterfaceContainer getContainer()
protected boolean allowVoid()
true
if the drop down should have an empty entry,
false
otherwise.protected java.lang.reflect.Method getGetMethod()
null
if no method is provided.protected java.lang.reflect.Method getSetMethod()
null
if no method is provided.public void setSelectedItem(java.lang.Object selection)
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()
Provided to comply with the ComboBoxModel
interface.
getSelectedItem
in interface javax.swing.ComboBoxModel
public int getSize()
Provided to comply with the ListModel
interface (the parent
of ComboBoxModel
).
getSize
in interface javax.swing.ListModel
public java.lang.Object getElementAt(int index)
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(java.lang.Object ns, Profile profile, boolean isPhantom)
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.private boolean isAcceptible(java.lang.Object element)
element
- The model element to test.
true
if the element should be included in
the drop down list, false
otherwise.public void targetChanged()
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()
Null implementation provided here.
Provided to comply with the UMLUserInterfaceComponent
interface.
targetReasserted
in interface UMLUserInterfaceComponent
public void updateElement(java.lang.Object addedElement)
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(java.lang.Object removedElement)
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(ru.novosoft.uml.MElementEvent event)
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.
roleAdded
in interface ru.novosoft.uml.MElementListener
event
- The event which triggered this method.public void roleRemoved(ru.novosoft.uml.MElementEvent event)
We're only interested in the case where the name is "ownedElement", indicating an element has been removed from the namespace.
roleRemoved
in interface ru.novosoft.uml.MElementListener
event
- The event which triggered this method.MElementListener.roleRemoved(MElementEvent)
public void recovered(ru.novosoft.uml.MElementEvent event)
Null implementation in this case.
recovered
in interface ru.novosoft.uml.MElementListener
event
- The event which triggered this method.MElementListener.recovered(MElementEvent)
public void listRoleItemSet(ru.novosoft.uml.MElementEvent event)
Null implementation in this case.
listRoleItemSet
in interface ru.novosoft.uml.MElementListener
event
- The event which triggered this method.MElementListener.listRoleItemSet(MElementEvent)
public void removed(ru.novosoft.uml.MElementEvent event)
We must remove it from the set if it is there.
removed
in interface ru.novosoft.uml.MElementListener
event
- The event which triggered this method.MElementListener.removed(MElementEvent)
public void propertySet(ru.novosoft.uml.MElementEvent event)
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.
propertySet
in interface ru.novosoft.uml.MElementListener
event
- The event which triggered this method.MElementListener.propertySet(MElementEvent)
public void actionPerformed(java.awt.event.ActionEvent event)
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-2004 (20040316) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |