|
||||||||||
| 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
nl.knowledgeplaza.util.collection.ObservableList
public class ObservableList
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 java.util.ArrayList |
listeners
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(java.util.Collection 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,
java.lang.Object element)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
add(java.lang.Object o)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
addAll(java.util.Collection c)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
addAll(int index,
java.util.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. |
java.lang.Object |
getObservedCollection()
To access the collection that is being observed. |
java.lang.Object |
remove(int index)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
remove(java.lang.Object o)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
removeAll(java.util.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(java.util.Collection c)
Calls the super class's corresponding method and fires a CollectionEvent. |
java.lang.Object |
set(int index,
java.lang.Object 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 java.util.ArrayList listeners
| Constructor Detail |
|---|
public ObservableList(int initialCapacity)
initialCapacity - the initial capacity of the listpublic ObservableList()
public ObservableList(java.util.Collection c)
c - the collection whose elements are to be placed into this list.| Method Detail |
|---|
public boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in interface java.util.Listadd in class java.util.ArrayListpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.Listremove in class java.util.ArrayListpublic boolean addAll(java.util.Collection c)
addAll in interface java.util.CollectionaddAll in interface java.util.ListaddAll in class java.util.ArrayList
public boolean addAll(int index,
java.util.Collection c)
addAll in interface java.util.ListaddAll in class java.util.ArrayListpublic boolean removeAll(java.util.Collection c)
removeAll in interface java.util.CollectionremoveAll in interface java.util.ListremoveAll in class java.util.AbstractCollectionpublic void clear()
clear in interface java.util.Collectionclear in interface java.util.Listclear in class java.util.ArrayList
public java.lang.Object set(int index,
java.lang.Object element)
set in interface java.util.Listset in class java.util.ArrayList
public void add(int index,
java.lang.Object element)
add in interface java.util.Listadd in class java.util.ArrayListpublic java.lang.Object remove(int index)
remove in interface java.util.Listremove in class java.util.ArrayListpublic boolean retainAll(java.util.Collection c)
retainAll in interface java.util.CollectionretainAll in interface java.util.ListretainAll in class java.util.AbstractCollectionpublic void addCollectionListener(CollectionListener l)
addCollectionListener in interface ObservableCollectionl - the CollectionListenerpublic void removeCollectionListener(CollectionListener l)
removeCollectionListener in interface ObservableCollectionl - the CollectionListenerprotected void fireCollectionEvent(CollectionEvent e)
e - the CollectionEventpublic java.lang.Object getObservedCollection()
getObservedCollection in interface ObservableCollection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||