com.isti.util.gui
Class IstiListComboBoxModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by com.isti.util.gui.IstiListComboBoxModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.ComboBoxModel, javax.swing.ListModel, javax.swing.MutableComboBoxModel

public class IstiListComboBoxModel
extends javax.swing.AbstractListModel
implements javax.swing.MutableComboBoxModel

Class IstiListComboBoxModel defines a list combo box model.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
IstiListComboBoxModel(java.util.List objects, java.lang.Object selectedObject)
          Constructs a station combo box model.
 
Method Summary
 void addElement(java.lang.Object obj)
          Adds an item at the end of the model.
 java.lang.Object getElementAt(int index)
          Gets the value at the specified index.
 java.lang.Object getSelectedItem()
          Gets the selected item.
 int getSize()
          Gets the length of the list.
 void insertElementAt(java.lang.Object obj, int index)
          Adds an item at a specific index.
 void removeAllElements()
          Empties the list.
 void removeElement(java.lang.Object obj)
          Removes an item from the model.
 void removeElementAt(int index)
          Removes an item at a specific index.
 void setSelectedItem(java.lang.Object anItem)
          Set the selected item.
 
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
 

Constructor Detail

IstiListComboBoxModel

public IstiListComboBoxModel(java.util.List objects,
                             java.lang.Object selectedObject)
Constructs a station combo box model.

Parameters:
objects - the list of objects.
selectedObject - the selected object.
Method Detail

addElement

public void addElement(java.lang.Object obj)
Adds an item at the end of the model.

Specified by:
addElement in interface javax.swing.MutableComboBoxModel
Parameters:
obj - the Object to be added

getElementAt

public java.lang.Object getElementAt(int index)
Gets the value at the specified index.

Specified by:
getElementAt in interface javax.swing.ListModel
Parameters:
index - the requested index.
Returns:
the value at index.

getSelectedItem

public java.lang.Object getSelectedItem()
Gets the selected item.

Specified by:
getSelectedItem in interface javax.swing.ComboBoxModel
Returns:
the selected item or null if there is no selection.

getSize

public int getSize()
Gets the length of the list.

Specified by:
getSize in interface javax.swing.ListModel
Returns:
the length of the list.

insertElementAt

public void insertElementAt(java.lang.Object obj,
                            int index)
Adds an item at a specific index.

Specified by:
insertElementAt in interface javax.swing.MutableComboBoxModel
Parameters:
obj - the Object to be added
index - location to add the object

removeAllElements

public void removeAllElements()
Empties the list.


removeElement

public void removeElement(java.lang.Object obj)
Removes an item from the model.

Specified by:
removeElement in interface javax.swing.MutableComboBoxModel
Parameters:
obj - the Object to be removed

removeElementAt

public void removeElementAt(int index)
Removes an item at a specific index. The implementation of this method should notify all registered ListDataListeners that the item has been removed.

Specified by:
removeElementAt in interface javax.swing.MutableComboBoxModel
Parameters:
index - location of object to be removed

setSelectedItem

public void setSelectedItem(java.lang.Object anItem)
Set the selected item.

Specified by:
setSelectedItem in interface javax.swing.ComboBoxModel
Parameters:
anItem - the selected item or null for no selection.