|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.dmonix.gui.models.SortableListModel
This is a basic non-sorted list model with the added possibility to sort the
model at any time.
This class is well suited for large amounts of data since
it uses a very fast sorting algorithm.
Copyright: Copyright (c) 2003
Company: dmonix.org
| Field Summary | |
protected java.util.Vector |
data
|
protected java.util.Vector |
listeners
|
| Constructor Summary | |
SortableListModel()
Creates a basic character case sensitive list model. |
|
SortableListModel(boolean ignoreCase)
Creates a basic character case (in)sensitive list model. |
|
SortableListModel(java.util.Comparator comparator)
Creates a list model with custom comparator. |
|
| Method Summary | |
void |
addElement(java.lang.Object o)
Adds the specified component to the end of this list. |
void |
addListDataListener(javax.swing.event.ListDataListener l)
Adds a listener to the list that's notified each time a change to the data model occurs. |
void |
clear()
Removes all of the elements from this list. |
java.util.Enumeration |
elements()
List the data as an enum. |
void |
ensureCapacity(int minCapacity)
Increases the capacity of this list. |
protected void |
fireEvent(int event,
int startIndex,
int endIndex)
|
java.lang.Object |
getElementAt(int index)
Returns the component at the specified index. |
int |
getSize()
Returns the number of components in this list. |
boolean |
removeElement(java.lang.Object obj)
Removes the first (lowest-indexed) occurrence of the argument from this list. |
java.lang.Object |
removeElementAt(int index)
Deletes the object at the specified index. |
void |
removeListDataListener(javax.swing.event.ListDataListener l)
Removes a listener from the list that's notified each time a change to the data model occurs. |
void |
setComparator(java.util.Comparator comparator)
Set the Comparator used in the sort method. |
void |
sort()
Sorts the specified list using the specified comparator. |
java.lang.Object[] |
toArray()
Returns an array representation of this list model. |
void |
toArray(java.lang.Object[] array)
Copies the components of this model into the specified array. |
void |
trimToSize()
Trims the data container. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.Vector data
protected java.util.Vector listeners
| Constructor Detail |
public SortableListModel()
SortableListModel(false)
public SortableListModel(boolean ignoreCase)
IgnoreCaseComparator.
ignoreCase - character sensitive or notIgnoreCaseComparatorpublic SortableListModel(java.util.Comparator comparator)
comparator - The comparator| Method Detail |
public void addListDataListener(javax.swing.event.ListDataListener l)
addListDataListener in interface javax.swing.ListModell - The listener to addpublic void removeListDataListener(javax.swing.event.ListDataListener l)
removeListDataListener in interface javax.swing.ListModell - The listener to removepublic void addElement(java.lang.Object o)
java.lang.Comparable
sort method.
o - The object to add
java.lang.IllegalArgumentException - If the provided object doesn't implement java.lang.Comparablepublic void clear()
public java.util.Enumeration elements()
public void ensureCapacity(int minCapacity)
minCapacity - The minimum capacitypublic java.lang.Object getElementAt(int index)
getElementAt in interface javax.swing.ListModelindex - The index
public int getSize()
getSize in interface javax.swing.ListModelpublic boolean removeElement(java.lang.Object obj)
obj - The object to remove
public java.lang.Object removeElementAt(int index)
index - The index
public void setComparator(java.util.Comparator comparator)
Comparator used in the sort method.
comparator - The comparatorpublic void sort()
java.util.Collections.sort for further
information.
public java.lang.Object[] toArray()
public void toArray(java.lang.Object[] array)
array - The array to store the data inpublic void trimToSize()
protected void fireEvent(int event,
int startIndex,
int endIndex)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||