|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.AbstractListModel
org.tbee.swing.SortedListModel
public class SortedListModel
SortedListModel decorates an unsorted ListModel to provide a sorted model. You can create a SortedListModel from models you already have. Place the SortedListModel into a JList, for example, to provide a sorted view of your underlying model.
| Field Summary | |
|---|---|
static int |
ASCENDING
|
static int |
DESCENDING
|
static int |
UNORDERED
|
| Fields inherited from class javax.swing.AbstractListModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
SortedListModel(javax.swing.ListModel model)
Create a SortedListModel from an existing model using a default text comparator for the default Locale. |
|
SortedListModel(javax.swing.ListModel model,
int sortOrder)
Create a SortedListModel from an existing model using a specific comparator and sort order. |
|
SortedListModel(javax.swing.ListModel model,
int sortOrder,
java.util.Comparator comp)
Create a SortedListModel from an existing model. |
|
| Method Summary | |
|---|---|
java.lang.Object |
getElementAt(int index)
Retrieve the sorted entry from the original model |
int |
getSize()
Retrieve the size of the underlying model |
static void |
main(java.lang.String[] args)
|
void |
setComparator(java.util.Comparator comp)
|
void |
setSortOrder(int sortOrder)
Change the sort order of the model at runtime |
int |
toSortedModelIndex(int unsortedIndex)
Convert an unsorted model index to a sorted model index. |
int[] |
toSortedModelIndices(int[] unsortedModelIndices)
Convert an array of unsorted model selection indices to indices in the sorted model. |
int |
toUnsortedModelIndex(int index)
Convert sorted model index to an unsorted model index. |
int[] |
toUnsortedModelIndices(int[] sortedSelectedIndices)
Convert an array of sorted model indices to their unsorted model indices. |
| 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 |
| Field Detail |
|---|
public static int UNORDERED
public static int ASCENDING
public static int DESCENDING
| Constructor Detail |
|---|
public SortedListModel(javax.swing.ListModel model)
model - the underlying, unsorted ListModel
public SortedListModel(javax.swing.ListModel model,
int sortOrder)
model - the unsorted list modelsortOrder - that should be used
public SortedListModel(javax.swing.ListModel model,
int sortOrder,
java.util.Comparator comp)
model - sortOrder - comp - | Method Detail |
|---|
public java.lang.Object getElementAt(int index)
throws java.lang.IndexOutOfBoundsException
index - index of an entry in the sorted model
java.lang.IndexOutOfBoundsExceptionpublic int getSize()
public int toUnsortedModelIndex(int index)
throws java.lang.IndexOutOfBoundsException
index - an index in the sorted model
java.lang.IndexOutOfBoundsExceptionpublic int[] toUnsortedModelIndices(int[] sortedSelectedIndices)
sortedSelectedIndices - indices of selected elements in the sorted model or sorted view
public int toSortedModelIndex(int unsortedIndex)
unsortedIndex - an element index in the unsorted model
public int[] toSortedModelIndices(int[] unsortedModelIndices)
unsortedModelIndices -
public void setComparator(java.util.Comparator comp)
public void setSortOrder(int sortOrder)
sortOrder - public static void main(java.lang.String[] args)
args -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||