|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.AbstractListModel javax.swing.DefaultListModel edu.northwestern.at.utils.swing.SortedListModel
public class SortedListModel
Sorted list model.
This class extends DefaultListModel to support sorted lists.
All elements must implement the Comparable interface.
Field Summary |
---|
Fields inherited from class javax.swing.AbstractListModel |
---|
listenerList |
Constructor Summary | |
---|---|
SortedListModel()
Constructs a new empty sorted list model. |
Method Summary | |
---|---|
void |
add(int index,
java.lang.Object element)
Prohibits attempts to add elements at specific locations. |
int |
add(java.lang.Object obj)
Adds an element to the list. |
void |
addElement(java.lang.Object element)
Prohibits attempts to add elements at the end of the list. |
void |
insertElementAt(java.lang.Object obj,
int index)
Prohibits attempts to add elements at specific locations. |
void |
redraw(int index)
Redraws an element after a change. |
boolean |
remove(java.lang.Object obj)
Removes an element from the list. |
boolean |
removeElement(java.lang.Object obj)
Removes an element from the list. |
java.lang.Object |
set(int index,
java.lang.Object element)
Prohibits attempts to set an element. |
void |
setData(java.util.List list)
Sets new list data. |
void |
setElementAt(java.lang.Object obj,
int index)
Prohibits attempts to set an element. |
Methods inherited from class javax.swing.DefaultListModel |
---|
capacity, clear, contains, copyInto, elementAt, elements, ensureCapacity, firstElement, get, getElementAt, getSize, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeAllElements, removeElementAt, removeRange, setSize, size, toArray, toString, trimToSize |
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, wait, wait, wait |
Constructor Detail |
---|
public SortedListModel()
Method Detail |
---|
public int add(java.lang.Object obj)
The element must be comparable. It is added in the correct sorted position in the list. If the element or one equal to it is already in the list it is ignored.
obj
- The element to be added to the list.
public boolean removeElement(java.lang.Object obj)
removeElement
in class javax.swing.DefaultListModel
obj
- The element to be removed from the list.
public boolean remove(java.lang.Object obj)
This method is the same as removeElement
.
obj
- The element to be removed from the list.
public void setData(java.util.List list)
The list is sorted. The sorted list replaces the previous list data.
list
- The new list data. public void redraw(int index)
index
- Element index. public void addElement(java.lang.Object element)
addElement
in class javax.swing.DefaultListModel
java.lang.UnsupportedOperationException
public void add(int index, java.lang.Object element)
add
in class javax.swing.DefaultListModel
java.lang.UnsupportedOperationException
public void insertElementAt(java.lang.Object obj, int index)
insertElementAt
in class javax.swing.DefaultListModel
java.lang.UnsupportedOperationException
public java.lang.Object set(int index, java.lang.Object element)
set
in class javax.swing.DefaultListModel
java.lang.UnsupportedOperationException
public void setElementAt(java.lang.Object obj, int index)
setElementAt
in class javax.swing.DefaultListModel
java.lang.UnsupportedOperationException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |