|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjavax.swing.AbstractListModel
javax.swing.DefaultComboBoxModel
com.wordpress.tipsforjava.swing.SortedComboBoxModel
class SortedComboBoxModel extends DefaultComboBoxModel
Custom model to make sure the items are stored in a sorted order. The default is to sort in the natural order of the item, but a Comparator can be used to customize the sort order. The data is initially sorted before the model is created. Any updates to the model will cause the items to be inserted in sorted order.
| Field Summary | |
|---|---|
private Comparator |
comparator
|
| Constructor Summary | |
SortedComboBoxModel()
|
|
SortedComboBoxModel(Comparator comparator)
|
|
SortedComboBoxModel(Object[] items)
|
|
SortedComboBoxModel(Object[] items, Comparator comparator)
|
|
SortedComboBoxModel(Vector items)
|
|
SortedComboBoxModel(Vector items, Comparator comparator)
|
|
| Method Summary | |
|---|---|
void
|
addElement(Object element)
|
void
|
insertElementAt(Object element, int index)
|
protected static Object[]
|
sortArray(Object[] items, Comparator comparator)
|
protected static Vector
|
sortVector(Vector items, Comparator comparator)
|
| Methods inherited from class DefaultComboBoxModel | |
|---|---|
| addElement, getSize, removeElementAt, insertElementAt, removeElement, removeAllElements, setSelectedItem, getSelectedItem, getElementAt, getIndexOf, getListeners, addListDataListener, removeListDataListener, getListDataListeners, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Methods inherited from class AbstractListModel | |
|---|---|
| getListeners, addListDataListener, removeListDataListener, getListDataListeners, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll, getSize, getElementAt |
| Field Detail |
|---|
private Comparator comparator
| Constructor Detail |
|---|
public SortedComboBoxModel()
public SortedComboBoxModel(Comparator comparator)
public SortedComboBoxModel(Object[] items)
public SortedComboBoxModel(Object[] items, Comparator comparator)
public SortedComboBoxModel(Vector items)
public SortedComboBoxModel(Vector items, Comparator comparator)
| Method Detail |
|---|
de public public void addElement(Object element)
ssWarnings("unchecked")
@Overri
de
public
public void insertElementAt(Object element, int index)
ssWarnings("unchecked")
protect
protected static Object[] sortArray(Object[] items, Comparator comparator)
ssWarnings("unchecked")
protect
protected static Vector sortVector(Vector items, Comparator comparator)
Groovy Documentation