|
|||||||||||
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.UMLComboBoxModel2
ComboBoxmodel for UML modelelements. This implementation does not use reflection and seperates Model, View and Controller better then does the former UMLComboBoxModel.
This combobox allows selecting no value, if so indicated at construction time of this class. I.e. it is "clearable".
Field Summary | |
private boolean |
buildingModel
Flag to indicate wether the model is being build |
private Object |
comboBoxTarget
The taget of the comboboxmodel. |
private boolean |
fireListEvents
Flag to indicate wether list events should be fired |
private boolean |
isClearable
Flag to indicate if the user may select "" as value in the combobox. |
private static Logger |
LOG
|
private List |
objects
The list with objects that should be shown in the combobox |
private String |
propertySetName
The name of the event with which NSUML sets the attribute that is shown in this comboboxmodel. |
private Object |
selectedObject
The selected object |
Fields inherited from class javax.swing.AbstractListModel |
listenerList |
Constructor Summary | |
UMLComboBoxModel2(String name,
boolean clearable)
Constructs a model for a combobox. |
Method Summary | |
protected void |
addAll(Collection col)
Utility method to add a collection of elements to the model |
void |
addElement(Object o)
|
protected abstract void |
buildModelList()
Builds the list of elements and sets the selectedIndex to the currently selected item if there is one. |
boolean |
contains(Object elem)
Returns true if some object elem is contained by the list of choices |
protected void |
fireContentsChanged(Object source,
int index0,
int index1)
|
protected void |
fireIntervalAdded(Object source,
int index0,
int index1)
|
protected void |
fireIntervalRemoved(Object source,
int index0,
int index1)
|
protected Object |
getChangedElement(ru.novosoft.uml.MElementEvent e)
Utility method to get the changed element from some event e |
Object |
getElementAt(int index)
|
int |
getIndexOf(Object o)
|
Object |
getSelectedItem()
|
protected abstract Object |
getSelectedModelElement()
Gets the modelelement that is selected in the NSUML model. |
int |
getSize()
|
protected Object |
getTarget()
Utility method to get the target. |
protected abstract boolean |
isValidElement(Object element)
Returns true if the given element is valid, i.e. |
protected boolean |
isValidEvent(ru.novosoft.uml.MElementEvent e)
Returns true if some event is valid. |
void |
listRoleItemSet(ru.novosoft.uml.MElementEvent e)
|
void |
propertyChange(PropertyChangeEvent evt)
If the property that this comboboxmodel depicts is changed in the UML model, this method will make sure that it is changed in the comboboxmodel too. |
void |
propertySet(ru.novosoft.uml.MElementEvent e)
If the property that this comboboxmodel depicts is changed by the NSUML model, this method will make sure that it is changed in the comboboxmodel too. |
void |
recovered(ru.novosoft.uml.MElementEvent e)
|
protected void |
removeAll(Collection col)
Utility method to remove a collection of elements from the model. |
void |
removeAllElements()
Remove all elements. |
void |
removed(ru.novosoft.uml.MElementEvent e)
|
void |
removeElement(Object o)
|
void |
roleAdded(ru.novosoft.uml.MElementEvent e)
|
void |
roleRemoved(ru.novosoft.uml.MElementEvent e)
|
protected void |
setElements(Collection elements)
Utility method to change all elements in the list with modelelements at once. |
void |
setSelectedItem(Object o)
|
protected void |
setTarget(Object target)
Sets the target. |
void |
targetAdded(TargetEvent e)
Fired when a target is added to the list of targets. |
void |
targetRemoved(TargetEvent e)
Fired when a target is removed from the list of targets |
void |
targetSet(TargetEvent e)
Fired when a total new set of targets is set |
Methods inherited from class javax.swing.AbstractListModel |
addListDataListener, 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 final Logger LOG
private Object comboBoxTarget
private List objects
private Object selectedObject
private boolean isClearable
private String propertySetName
private boolean fireListEvents
private boolean buildingModel
Constructor Detail |
public UMLComboBoxModel2(String name, boolean clearable)
name
- The name of the NSUML event that must be
fired to set the selected item programmatically (via setting
the NSUML model)clearable
- Flag to indicate if the user may select ""
as value in the combobox. If true the attribute that is shown
by this combobox may be set to null.
Makes sure that there is allways a "" in the list with objects so the
user has the oportunity to select this to clear the attribute.
IllegalArgumentException
- if one of the arguments is nullMethod Detail |
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
public void listRoleItemSet(ru.novosoft.uml.MElementEvent e)
listRoleItemSet
in interface ru.novosoft.uml.MElementListener
MElementListener.listRoleItemSet(MElementEvent)
public void propertySet(ru.novosoft.uml.MElementEvent e)
TODO: MVW I tested this for the PropPanelCallEvent. It also works without this function. Why do we need this?
propertySet
in interface ru.novosoft.uml.MElementListener
MElementListener.propertySet(MElementEvent)
public void recovered(ru.novosoft.uml.MElementEvent e)
recovered
in interface ru.novosoft.uml.MElementListener
MElementListener.recovered(MElementEvent)
public void removed(ru.novosoft.uml.MElementEvent e)
removed
in interface ru.novosoft.uml.MElementListener
MElementListener.removed(MElementEvent)
public void roleAdded(ru.novosoft.uml.MElementEvent e)
roleAdded
in interface ru.novosoft.uml.MElementListener
MElementListener.roleAdded(MElementEvent)
public void roleRemoved(ru.novosoft.uml.MElementEvent e)
roleRemoved
in interface ru.novosoft.uml.MElementListener
MElementListener.roleRemoved(MElementEvent)
protected abstract boolean isValidElement(Object element)
element
- the given element
protected abstract void buildModelList()
protected void setElements(Collection elements)
elements
- the given elementsprotected Object getTarget()
protected void removeAll(Collection col)
col
- the elements to be removedprotected void addAll(Collection col)
col
- the elements to be adddprotected Object getChangedElement(ru.novosoft.uml.MElementEvent e)
e
- the given event
protected void setTarget(Object target)
target
- the targetprotected abstract Object getSelectedModelElement()
public Object getElementAt(int index)
getElementAt
in interface ListModel
ListModel.getElementAt(int)
public int getSize()
getSize
in interface ListModel
ListModel.getSize()
public int getIndexOf(Object o)
o
- the given element
public void addElement(Object o)
o
- the element to be addedpublic void setSelectedItem(Object o)
setSelectedItem
in interface ComboBoxModel
ComboBoxModel.setSelectedItem(java.lang.Object)
public void removeElement(Object o)
o
- the element to be removedpublic void removeAllElements()
public Object getSelectedItem()
getSelectedItem
in interface ComboBoxModel
ComboBoxModel.getSelectedItem()
public boolean contains(Object elem)
elem
- the given element
protected boolean isValidEvent(ru.novosoft.uml.MElementEvent e)
e
- the event
protected void fireContentsChanged(Object source, int index0, int index1)
AbstractListModel.fireContentsChanged(
Object, int, int)
protected void fireIntervalAdded(Object source, int index0, int index1)
AbstractListModel.fireIntervalAdded(
Object, int, int)
protected void fireIntervalRemoved(Object source, int index0, int index1)
AbstractListModel.fireIntervalRemoved(
Object, int, int)
public void targetAdded(TargetEvent e)
TargetListener
targetAdded
in interface TargetListener
e
- The targetevent, name will be TARGET_ADDEDTargetListener.targetAdded(TargetEvent)
public void targetRemoved(TargetEvent e)
TargetListener
targetRemoved
in interface TargetListener
e
- The targetevent, name will be TARGET_REMOVEDTargetListener.targetRemoved(TargetEvent)
public void targetSet(TargetEvent e)
TargetListener
targetSet
in interface TargetListener
e
- The targetevent, name will be TARGET_SETTargetListener.targetSet(TargetEvent)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20050222) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |