org.moyoman.client.reference.util
Class AlphabetizedComboBoxModel

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--org.moyoman.client.reference.util.AlphabetizedComboBoxModel
All Implemented Interfaces:
ComboBoxModel, ListModel, MutableComboBoxModel, Serializable

public class AlphabetizedComboBoxModel
extends AbstractListModel
implements MutableComboBoxModel

Provides a combo box model with alphabetized items.

Since:
v0.16
Version:
v0.16
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Field Summary
private  List _data
          Data collection.
private  Object _selectedItem
          Selected item.
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
AlphabetizedComboBoxModel()
           
 
Method Summary
 void addElement(Object element)
          Adds an item to the model.
 Object getElementAt(int index)
          Return the element at the given index.
 Object getSelectedItem()
          Return the selected item.
 int getSize()
          Return the number of items in the model.
 void insertElementAt(Object element, int index)
          Add an item from the model.
 void removeElement(Object element)
          Removes an item from the model.
 void removeElementAt(int index)
          Removes an item from the model.
 void setSelectedItem(Object item)
          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
 

Field Detail

_data

private List _data
Data collection.


_selectedItem

private Object _selectedItem
Selected item.

Constructor Detail

AlphabetizedComboBoxModel

public AlphabetizedComboBoxModel()
Method Detail

getElementAt

public Object getElementAt(int index)
Return the element at the given index.

Specified by:
getElementAt in interface ListModel
Parameters:
index - Index of the element of interest.
Since:
v0.16

setSelectedItem

public void setSelectedItem(Object item)
Set the selected item.

Specified by:
setSelectedItem in interface ComboBoxModel
Parameters:
item - New selected item.
Since:
v0.16

getSelectedItem

public Object getSelectedItem()
Return the selected item.

Specified by:
getSelectedItem in interface ComboBoxModel
Since:
v0.16

getSize

public int getSize()
Return the number of items in the model.

Specified by:
getSize in interface ListModel
Since:
v0.16

addElement

public void addElement(Object element)
Adds an item to the model.

Specified by:
addElement in interface MutableComboBoxModel
Since:
v0.16

insertElementAt

public void insertElementAt(Object element,
                            int index)
Add an item from the model. Because this model is alphabetized, the index is ignored.

Specified by:
insertElementAt in interface MutableComboBoxModel
Since:
v0.16

removeElement

public void removeElement(Object element)
Removes an item from the model.

Specified by:
removeElement in interface MutableComboBoxModel
Since:
v0.16

removeElementAt

public void removeElementAt(int index)
Removes an item from the model. Because this model is alphabetized, the index is ignored.

Specified by:
removeElementAt in interface MutableComboBoxModel
Since:
v0.16