org.objectweb.jac.aspects.gui
Class ComboBoxModel

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--org.objectweb.jac.aspects.gui.LessAbstractListModel
              |
              +--org.objectweb.jac.aspects.gui.ComboBoxModel
All Implemented Interfaces:
CollectionModel, CollectionUpdate, ComboBoxModel, ListModel, Model, ObjectChooserModel, ObjectUpdate, Serializable

public class ComboBoxModel
extends LessAbstractListModel
implements ObjectChooserModel

This is an abstract representation of a combo box.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
ComboBoxModel()
          The constructor for an independent combobox model.
ComboBoxModel(CollectionItem collection, Object substance)
          The constructor for a combobox model that is linked to a collection (values will be consistent).
 
Method Summary
 void addObject(Object object, String label)
          Adds an object in the combo box.
 Object getSelectedItem()
          Returns the currently selected object of the combo (same as getSelectedObject).
 Object getSelectedObject()
          Returns the currently selected object of the combo (same as getSelectedItem).
 ClassItem getType()
          Returns the type of the elements contained in the combo box.
 void setSelectedItem(Object object)
          Sets the selected object by it's name.
 void setSelectedObject(Object object)
          Sets the selected object
 void setType(ClassItem type)
          Set the type of elements contained in the combo box.
 
Methods inherited from class org.objectweb.jac.aspects.gui.LessAbstractListModel
addObject, close, getCollection, getElementAt, getObject, getRowCount, getSize, indexOf, isCellEditable, objectUpdated, onAdd, onChange, onRemove, setNullLabel, sort, unregisterViews
 
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, getElementAt, getSize, removeListDataListener
 

Constructor Detail

ComboBoxModel

public ComboBoxModel()
The constructor for an independent combobox model.


ComboBoxModel

public ComboBoxModel(CollectionItem collection,
                     Object substance)
The constructor for a combobox model that is linked to a collection (values will be consistent).

Parameters:
collection - the substance collection
substance - the object that holds the collection's value
Method Detail

addObject

public void addObject(Object object,
                      String label)
Adds an object in the combo box.

Overrides:
addObject in class LessAbstractListModel
Parameters:
object - the new object
label - the associated label
See Also:
LessAbstractListModel.addObject(Object)

getSelectedItem

public Object getSelectedItem()
Returns the currently selected object of the combo (same as getSelectedObject).

Specified by:
getSelectedItem in interface ComboBoxModel

setSelectedItem

public void setSelectedItem(Object object)
Sets the selected object by it's name.

Specified by:
setSelectedItem in interface ComboBoxModel
Parameters:
object - name of the object to select (should be a String)
See Also:
setSelectedObject(Object)

setSelectedObject

public void setSelectedObject(Object object)
Sets the selected object

Parameters:
object - the object to select
See Also:
setSelectedItem(Object)

getSelectedObject

public Object getSelectedObject()
Returns the currently selected object of the combo (same as getSelectedItem).


setType

public void setType(ClassItem type)
Description copied from interface: ObjectChooserModel
Set the type of elements contained in the combo box.

Specified by:
setType in interface ObjectChooserModel

getType

public ClassItem getType()
Description copied from interface: ObjectChooserModel
Returns the type of the elements contained in the combo box.

Specified by:
getType in interface ObjectChooserModel