public class NXSortedListModel extends javax.swing.AbstractListModel implements NXListModel
| Modifier and Type | Class and Description |
|---|---|
static class |
NXSortedListModel.SortOrder |
| Constructor and Description |
|---|
NXSortedListModel(NXDefaultListModel model)
Create a SortedListModel from an existing model
using a default text comparator for the default Locale.
|
NXSortedListModel(NXDefaultListModel model,
NXSortedListModel.SortOrder sortOrder)
Create a SortedListModel from an existing model
using a specific comparator and sort order.
|
NXSortedListModel(NXDefaultListModel model,
NXSortedListModel.SortOrder sortOrder,
java.util.Comparator comp)
Create a SortedListModel from an existing model.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(java.lang.Object obj) |
java.lang.Object |
getElementAt(int index)
Retrieve the sorted entry from the original model
|
int |
getSize()
Retrieve the size of the underlying model
|
void |
removeElementAt(int obj) |
void |
setComparator(java.util.Comparator comp) |
void |
setSortOrder(NXSortedListModel.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.
|
public NXSortedListModel(NXDefaultListModel model)
model - the underlying, unsorted ListModelpublic NXSortedListModel(NXDefaultListModel model, NXSortedListModel.SortOrder sortOrder)
model - the unsorted list modelsortOrder - that should be usedpublic NXSortedListModel(NXDefaultListModel model, NXSortedListModel.SortOrder sortOrder, java.util.Comparator comp)
model - sortOrder - comp - public void addElement(java.lang.Object obj)
addElement in interface NXListModelpublic java.lang.Object getElementAt(int index)
throws java.lang.IndexOutOfBoundsException
getElementAt in interface javax.swing.ListModelgetElementAt in interface NXListModelindex - index of an entry in the sorted modeljava.lang.IndexOutOfBoundsExceptionpublic int getSize()
getSize in interface javax.swing.ListModelgetSize in interface NXListModelpublic int toUnsortedModelIndex(int index)
throws java.lang.IndexOutOfBoundsException
index - an index in the sorted modeljava.lang.IndexOutOfBoundsExceptionpublic 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(java.util.Comparator comp)
public void setSortOrder(NXSortedListModel.SortOrder sortOrder)
sortOrder - public void removeElementAt(int obj)
removeElementAt in interface NXListModel