public class OrderedListModel extends Object implements ListModel
Modifier and Type | Field and Description |
---|---|
private Collator |
collator |
private Vector |
data |
private Vector |
listeners |
Constructor and Description |
---|
OrderedListModel()
Construct a new, empty
OrderedListModel . |
OrderedListModel(Vector data)
Construct a new
OrderedListModel with the given data. |
Modifier and Type | Method and Description |
---|---|
void |
addElement(Object elem)
Add an object to the model.
|
void |
addListDataListener(ListDataListener listener)
Add a list data listener to this model's list of listeners.
|
void |
clear()
Remove all elements from the model.
|
boolean |
contains(Object elem)
Determine if the model contains an object.
|
Enumeration |
elements()
Get an enumeration of the elements in the model.
|
protected void |
fireContentsChanged()
Fire a contents changed event.
|
protected void |
fireIntervalAdded(int start,
int end)
Fire an interval added event.
|
protected void |
fireIntervalRemoved(int start,
int end)
Fire an interval removed event.
|
Object |
getElementAt(int index)
Get the object at the given index in the model.
|
int |
getSize()
Get the size of the model.
|
int |
indexOf(Object elem)
Get the index of an element in the model.
|
boolean |
isEmpty()
Determine if the model is empty.
|
void |
removeElementAt(int index)
Remove an element at the given index in the model.
|
void |
removeListDataListener(ListDataListener listener)
Remove a list data listener from this model's list of listeners.
|
void |
removeRange(int fromIndex,
int toIndex)
Remove a range of elements form the model.
|
void |
setCollator(Collator collator)
Set the collator to be used by this model.
|
public OrderedListModel()
OrderedListModel
.public OrderedListModel(Vector data)
OrderedListModel
with the given data.data
- A collection of elements to insert into the model. The
elements are inserted in sorted order.public void setCollator(Collator collator)
collator
- The collator.public void addListDataListener(ListDataListener listener)
addListDataListener
in interface ListModel
listener
- The listener to add.public void removeListDataListener(ListDataListener listener)
removeListDataListener
in interface ListModel
listener
- The listener to remove.public int getSize()
public Object getElementAt(int index)
getElementAt
in interface ListModel
index
- The index of the object to retrieve.null
if the index
is out of range.public void addElement(Object elem)
elem
- The new object to add.public void clear()
public boolean contains(Object elem)
elem
- The object to search for.true
if the object is in the model,
false
otherwise.public Enumeration elements()
public boolean isEmpty()
true
if there are no elements in the model,
false
otherwise.public void removeElementAt(int index)
index
- The index of the element to remove.public void removeRange(int fromIndex, int toIndex)
fromIndex
- The starting index of the range.toIndex
- The ending index of the range.protected void fireIntervalAdded(int start, int end)
start
- The starting index of the interval.end
- The ending index of the interval.protected void fireIntervalRemoved(int start, int end)
start
- The starting index of the interval.end
- The ending index of the interval.protected void fireContentsChanged()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses