|
|||||||||||
| 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 | |
protected boolean |
buildingModel
Flag to indicate whether the model is being build. |
| 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 void |
addOtherModelEventListeners(Object newTarget)
This function allows subclasses to listen to more modelelements. |
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(PropertyChangeEvent e)
Utility method to get the changed element from some event e. |
Object |
getElementAt(int index)
|
int |
getIndexOf(Object o)
|
protected String |
getName(Object obj)
|
protected String |
getPropertySetName()
|
Object |
getSelectedItem()
|
protected abstract Object |
getSelectedModelElement()
Gets the modelelement that is selected in the UML model. |
int |
getSize()
|
protected Object |
getTarget()
Utility method to get the target. |
protected boolean |
isClearable()
Return boolean indicating whether combo allows empty string. |
protected boolean |
isFireListEvents()
|
protected abstract boolean |
isValidElement(Object element)
Returns true if the given element is valid. |
protected boolean |
isValidEvent(PropertyChangeEvent e)
Returns true if some event is valid. |
void |
propertyChange(PropertyChangeEvent evt)
If the property that this comboboxmodel depicts is changed in the UML model, this method will make sure that the changes will be done in the combobox-model equally. |
protected void |
removeAll(Collection col)
Utility method to remove a collection of elements from the model. |
void |
removeAllElements()
Remove all elements. |
void |
removeElement(Object o)
|
protected void |
removeOtherModelEventListeners(Object oldTarget)
This function allows subclasses to listen to more modelelements. |
protected void |
setElements(Collection elements)
Utility method to change all elements in the list with modelelements at once. |
protected void |
setFireListEvents(boolean events)
|
void |
setSelectedItem(Object o)
|
protected void |
setTarget(Object theNewTarget)
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 |
protected boolean buildingModel
| Constructor Detail |
public UMLComboBoxModel2(String name,
boolean clearable)
name - The name of the property change event that must be
fired to set the selected item programmatically (via changing
the 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 null| Method Detail |
public void propertyChange(PropertyChangeEvent evt)
TODO: This function is not yet completely written!
propertyChange in interface PropertyChangeListenerPropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)protected abstract boolean isValidElement(Object element)
It is valid if it may be added to the list of elements.
element - the given element
protected abstract void buildModelList()
protected String getName(Object obj)
obj - an UML object
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(PropertyChangeEvent e)
e - the given event
protected void setTarget(Object theNewTarget)
This function is called when the user changes the target. Hence, this shall not result in any UML model changes. Hence, we block firing list events completely by setting buildingModel to true for the duration of this function.
This function looks a lot like the one in UMLModelElementListModel2.
theNewTarget - the targetprotected void removeOtherModelEventListeners(Object oldTarget)
oldTarget - the UML modelelementprotected void addOtherModelEventListeners(Object newTarget)
newTarget - the UML modelelementprotected abstract Object getSelectedModelElement()
public Object getElementAt(int index)
getElementAt in interface ListModelListModel.getElementAt(int)public int getSize()
getSize in interface ListModelListModel.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 ComboBoxModelComboBoxModel.setSelectedItem(java.lang.Object)public void removeElement(Object o)
o - the element to be removedpublic void removeAllElements()
public Object getSelectedItem()
getSelectedItem in interface ComboBoxModelComboBoxModel.getSelectedItem()public boolean contains(Object elem)
elem - the given element
protected boolean isValidEvent(PropertyChangeEvent 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 TargetListenere - The targetevent, name will be TARGET_ADDEDTargetListener.targetAdded(TargetEvent)public void targetRemoved(TargetEvent e)
TargetListener
targetRemoved in interface TargetListenere - The targetevent, name will be TARGET_REMOVEDTargetListener.targetRemoved(TargetEvent)public void targetSet(TargetEvent e)
TargetListener
targetSet in interface TargetListenere - The targetevent, name will be TARGET_SETTargetListener.targetSet(TargetEvent)protected boolean isClearable()
protected String getPropertySetName()
protected boolean isFireListEvents()
protected void setFireListEvents(boolean events)
events - The fireListEvents to set.
|
|||||||||||
| 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 |