public class SortedListModel extends AbstractListModel
| Modifier and Type | Class and Description |
|---|---|
static class |
SortedListModel.SortOrder |
listenerList| Constructor and Description |
|---|
SortedListModel(ListModel model)
Create a SortedListModel from an existing model
using a default text comparator for the default Locale.
|
SortedListModel(ListModel model,
SortedListModel.SortOrder sortOrder)
Create a SortedListModel from an existing model
using a specific comparator and sort order.
|
SortedListModel(ListModel model,
SortedListModel.SortOrder sortOrder,
Comparator comp)
Create a SortedListModel from an existing model.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getElementAt(int index)
Retrieve the sorted entry from the original model
|
int |
getSize()
Retrieve the size of the underlying model
|
void |
setComparator(Comparator comp)
Method setComparator
|
void |
setSortOrder(SortedListModel.SortOrder 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.
|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListenerpublic SortedListModel(ListModel model)
model - the underlying, unsorted ListModelpublic SortedListModel(ListModel model, SortedListModel.SortOrder sortOrder)
model - the unsorted list modelsortOrder - that should be usedpublic SortedListModel(ListModel model, SortedListModel.SortOrder sortOrder, Comparator comp)
model - sortOrder - comp - public Object getElementAt(int index) throws IndexOutOfBoundsException
index - index of an entry in the sorted modelIndexOutOfBoundsExceptionpublic int getSize()
public int toUnsortedModelIndex(int index)
throws IndexOutOfBoundsException
index - an index in the sorted modelIndexOutOfBoundsExceptionpublic int[] toUnsortedModelIndices(int[] sortedSelectedIndices)
sortedSelectedIndices - indices of selected elements in the sorted model
or sorted viewpublic int toSortedModelIndex(int unsortedIndex)
unsortedIndex - an element index in the unsorted modelpublic int[] toSortedModelIndices(int[] unsortedModelIndices)
unsortedModelIndices - public void setComparator(Comparator comp)
comp - public void setSortOrder(SortedListModel.SortOrder sortOrder)
sortOrder - Copyright © 2015 sd-svn. All rights reserved.