|
||||||||||
| 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<T>
nl.knowledgeplaza.util.collection.ObservableList<T>
public class ObservableList<T>
The ObservableList subclasses the ArrayList and overrides all the functions that change the internally stored collection. In the overridden function, it simply calls the super class's function and fires a CollectionEvent to let observers know the collection has changed. TOEU 2007-01-29: this implementation sucks! It does not update all changes, just that there has been a change. Made some improvements.
| Field Summary | |
|---|---|
protected ArrayList<CollectionListener> |
iListeners
the observers of this collection |
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
ObservableList()
Constructs an empty list with an initial capacity of ten. |
|
ObservableList(Collection<T> c)
Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator. |
|
ObservableList(int initialCapacity)
Constructs an empty list with the specified initial capacity. |
|
| Method Summary | |
|---|---|
void |
add(int index,
T element)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
add(T o)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
addAll(Collection c)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
addAll(int index,
Collection c)
Calls the super class's corresponding method and fires a CollectionEvent. |
void |
addCollectionListener(CollectionListener l)
Adds a listener to this collection. |
void |
clear()
Calls the super class's corresponding method and fires a CollectionEvent. |
protected void |
fireCollectionEvent(CollectionEvent e)
Fires a CollectionEvent to all listeners. |
Object |
getObservedCollection()
To access the collection that is being observed. |
T |
remove(int index)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
remove(Object o)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
removeAll(Collection c)
Calls the super class's corresponding method and fires a CollectionEvent. |
void |
removeCollectionListener(CollectionListener l)
Removes the listener from this collection. |
boolean |
retainAll(Collection c)
Calls the super class's corresponding method and fires a CollectionEvent. |
T |
set(int index,
T element)
Calls the super class's corresponding method and fires a CollectionEvent. |
| Methods inherited from class java.util.ArrayList |
|---|
clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, removeRange, 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, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
containsAll, equals, hashCode, iterator, listIterator, listIterator, subList |
| Field Detail |
|---|
protected ArrayList<CollectionListener> iListeners
| Constructor Detail |
|---|
public ObservableList(int initialCapacity)
initialCapacity - the initial capacity of the listpublic ObservableList()
public ObservableList(Collection<T> c)
c - the collection whose elements are to be placed into this list.| Method Detail |
|---|
public boolean add(T o)
add in interface Collection<T>add in interface List<T>add in class ArrayList<T>public boolean remove(Object o)
remove in interface Collection<T>remove in interface List<T>remove in class ArrayList<T>public boolean addAll(Collection c)
addAll in interface Collection<T>addAll in interface List<T>addAll in class ArrayList<T>
public boolean addAll(int index,
Collection c)
addAll in interface List<T>addAll in class ArrayList<T>public boolean removeAll(Collection c)
removeAll in interface Collection<T>removeAll in interface List<T>removeAll in class AbstractCollection<T>public void clear()
clear in interface Collection<T>clear in interface List<T>clear in class ArrayList<T>
public T set(int index,
T element)
set in interface List<T>set in class ArrayList<T>
public void add(int index,
T element)
add in interface List<T>add in class ArrayList<T>public T remove(int index)
remove in interface List<T>remove in class ArrayList<T>public boolean retainAll(Collection c)
retainAll in interface Collection<T>retainAll in interface List<T>retainAll in class AbstractCollection<T>public void addCollectionListener(CollectionListener l)
addCollectionListener in interface ObservableCollection<T>l - the CollectionListenerpublic void removeCollectionListener(CollectionListener l)
removeCollectionListener in interface ObservableCollection<T>l - the CollectionListenerprotected void fireCollectionEvent(CollectionEvent e)
e - the CollectionEventpublic Object getObservedCollection()
getObservedCollection in interface ObservableCollection<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||