|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<E>
com.jgoodies.binding.list.ArrayListModel<E>
E - the type of the list elementspublic final class ArrayListModel<E>
Adds ListModel capabilities to its superclass
ArrayList, i. e. allows to observe changes in the content and
structure. Useful for lists that are bound to list views, for example
JList, JComboBox and JTable.
| Field Summary |
|---|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
ArrayListModel()
Constructs an empty list with an initial capacity of ten. |
|
ArrayListModel(java.util.Collection<? extends E> c)
Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator. |
|
ArrayListModel(int initialCapacity)
Constructs an empty list with the specified initial capacity. |
|
| Method Summary | |
|---|---|
boolean |
add(E e)
Appends the specified element to the end of this list. |
void |
add(int index,
E element)
Inserts the specified element at the specified position in this list. |
boolean |
addAll(java.util.Collection<? extends E> c)
Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator. |
boolean |
addAll(int index,
java.util.Collection<? extends E> c)
Inserts all of the elements in the specified Collection into this list, starting at the specified position. |
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. |
void |
fireContentsChanged(int index)
Notifies all registered ListDataListeners that the element
at the specified index has changed. |
java.lang.Object |
getElementAt(int index)
Returns the value at the specified index. |
javax.swing.event.ListDataListener[] |
getListDataListeners()
Returns an array of all the list data listeners registered on this ArrayListModel. |
int |
getSize()
Returns the length of the list or 0 if there's no list. |
E |
remove(int index)
Removes the element at the specified position in this list. |
boolean |
remove(java.lang.Object o)
Removes a single instance of the specified element from this list, if it is present (optional operation). |
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. |
protected void |
removeRange(int fromIndex,
int toIndex)
Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive. |
E |
set(int index,
E element)
Replaces the element at the specified position in this list with the specified element. |
| Methods inherited from class java.util.ArrayList |
|---|
clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
|---|
equals, hashCode, iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeAll, retainAll, size, subList, toArray, toArray |
| Constructor Detail |
|---|
public ArrayListModel()
public ArrayListModel(int initialCapacity)
initialCapacity - the initial capacity of the list.
java.lang.IllegalArgumentException - if the specified initial capacity
is negativepublic ArrayListModel(java.util.Collection<? extends E> c)
ArrayListModel instance has an initial capacity of
110% the size of the specified collection.
c - the collection whose elements are to be placed into this list.
java.lang.NullPointerException - if the specified collection is
null| Method Detail |
|---|
public void add(int index,
E element)
add in interface java.util.List<E>add in class java.util.ArrayList<E>index - index at which the specified element is to be inserted.element - element to be inserted.
java.lang.IndexOutOfBoundsException - if index is out of range
(index < 0 || index > size()).public boolean add(E e)
add in interface java.util.Collection<E>add in interface java.util.List<E>add in class java.util.ArrayList<E>e - element to be appended to this list.
true (as per the general contract of Collection.add).
public boolean addAll(int index,
java.util.Collection<? extends E> c)
addAll in interface java.util.List<E>addAll in class java.util.ArrayList<E>index - index at which to insert first element
from the specified collection.c - elements to be inserted into this list.
true if this list changed as a result of the call.
java.lang.IndexOutOfBoundsException - if index out of range (index
< 0 || index > size()).
java.lang.NullPointerException - if the specified Collection is null.public boolean addAll(java.util.Collection<? extends E> c)
addAll in interface java.util.Collection<E>addAll in interface java.util.List<E>addAll in class java.util.ArrayList<E>c - the elements to be inserted into this list.
true if this list changed as a result of the call.
java.lang.NullPointerException - if the specified collection is null.public void clear()
clear in interface java.util.Collection<E>clear in interface java.util.List<E>clear in class java.util.ArrayList<E>public E remove(int index)
remove in interface java.util.List<E>remove in class java.util.ArrayList<E>index - the index of the element to removed.
java.lang.IndexOutOfBoundsException - if index out of range (index
< 0 || index >= size()).public boolean remove(java.lang.Object o)
This implementation looks for the index of the specified element.
If it finds the element, it removes the element at this index
by calling #remove(int) that fires a ListDataEvent.
remove in interface java.util.Collection<E>remove in interface java.util.List<E>remove in class java.util.ArrayList<E>o - element to be removed from this list, if present.
protected void removeRange(int fromIndex,
int toIndex)
(toIndex - fromIndex) elements.
(If toIndex==fromIndex, this operation has no effect.)
removeRange in class java.util.ArrayList<E>fromIndex - index of first element to be removed.toIndex - index after last element to be removed.
public E set(int index,
E element)
set in interface java.util.List<E>set in class java.util.ArrayList<E>index - index of element to replace.element - element to be stored at the specified position.
java.lang.IndexOutOfBoundsException - if index out of range
(index < 0 || index >= size()).public void addListDataListener(javax.swing.event.ListDataListener l)
addListDataListener in interface javax.swing.ListModell - the ListDataListener to be addedpublic void removeListDataListener(javax.swing.event.ListDataListener l)
removeListDataListener in interface javax.swing.ListModell - the ListDataListener to be removedpublic java.lang.Object getElementAt(int index)
getElementAt in interface javax.swing.ListModelindex - the requested index
indexpublic int getSize()
getSize in interface javax.swing.ListModelpublic void fireContentsChanged(int index)
ListDataListeners that the element
at the specified index has changed. Useful if there's a content change
without any structural change.This method must be called after the element of the list changes.
index - the index of the element that has changedEventListenerListpublic javax.swing.event.ListDataListener[] getListDataListeners()
ArrayListModel.
ListDataListeners,
or an empty array if no list data listeners
are currently registeredaddListDataListener(ListDataListener),
removeListDataListener(ListDataListener)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||