E - the list element typepublic abstract class AbstractObservableList<E> extends AbstractList<E> implements IObservableList<E>
This class is thread safe. All state accessing methods must be invoked from
the current realm. Methods for adding and removing
listeners may be invoked from any thread.
modCount| Constructor and Description |
|---|
AbstractObservableList() |
AbstractObservableList(Realm realm) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E o) |
boolean |
addAll(Collection<? extends E> c) |
boolean |
addAll(int index,
Collection<? extends E> c) |
void |
addChangeListener(IChangeListener listener)
Adds the given change listener to the list of change listeners.
|
void |
addDisposeListener(IDisposeListener listener)
Adds the given dispose listener to the list of dispose listeners.
|
void |
addListChangeListener(IListChangeListener<? super E> listener)
Adds the given list change listener to the list of list change listeners.
|
void |
addStaleListener(IStaleListener listener)
Adds the given stale listener to the list of stale listeners.
|
protected void |
checkRealm()
Asserts that the realm is the current realm.
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
void |
dispose()
Disposes of this observable object, removing all listeners registered
with this object, and all listeners this object might have registered on
other objects.
|
protected abstract int |
doGetSize() |
boolean |
equals(Object o) |
protected void |
fireChange()
Fires change event.
|
protected void |
fireListChange(ListDiff<E> diff) |
protected void |
fireStale()
Fires stale event.
|
protected void |
firstListenerAdded() |
Realm |
getRealm()
Returns the realm for this observable.
|
int |
hashCode() |
protected boolean |
hasListeners()
Returns whether this observable list has any registered listeners.
|
int |
indexOf(Object o) |
boolean |
isDisposed()
Returns whether the observable has been disposed
|
boolean |
isEmpty() |
boolean |
isStale()
Returns whether the state of this observable is stale and is expected to
change soon.
|
Iterator<E> |
iterator() |
int |
lastIndexOf(Object o) |
protected void |
lastListenerRemoved() |
E |
move(int oldIndex,
int newIndex)
Moves the element located at
oldIndex to
newIndex. |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
void |
removeChangeListener(IChangeListener listener)
Removes the given change listener from the list of change listeners.
|
void |
removeDisposeListener(IDisposeListener listener)
Removes the given dispose listener from the list of dispose listeners.
|
void |
removeListChangeListener(IListChangeListener<? super E> listener)
Removes the given list change listener from the list of list change
listeners.
|
void |
removeStaleListener(IStaleListener listener)
Removes the given stale listener from the list of stale listeners.
|
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
add, clear, get, listIterator, listIterator, remove, removeRange, set, subListtoStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitget, getElementType, listIterator, listIterator, remove, set, subListadd, clear, replaceAll, sort, spliteratorparallelStream, removeIf, streampublic AbstractObservableList(Realm realm)
realm - public AbstractObservableList()
protected boolean hasListeners()
public boolean isStale()
IObservableisStale in interface IObservablepublic void addListChangeListener(IListChangeListener<? super E> listener)
IObservableListaddListChangeListener in interface IObservableList<E>public void removeListChangeListener(IListChangeListener<? super E> listener)
IObservableListremoveListChangeListener in interface IObservableList<E>public void addChangeListener(IChangeListener listener)
IObservableaddChangeListener in interface IObservablepublic void removeChangeListener(IChangeListener listener)
IObservableremoveChangeListener in interface IObservablepublic void addStaleListener(IStaleListener listener)
IObservableaddStaleListener in interface IObservableIObservable.isStale()public void removeStaleListener(IStaleListener listener)
IObservableremoveStaleListener in interface IObservablepublic void addDisposeListener(IDisposeListener listener)
IObservableaddDisposeListener in interface IObservablelistener - the listener to addpublic void removeDisposeListener(IDisposeListener listener)
IObservableremoveDisposeListener in interface IObservablelistener - the listener to removeprotected void fireChange()
protected void fireStale()
protected void firstListenerAdded()
protected void lastListenerRemoved()
public boolean isDisposed()
IObservableisDisposed in interface IObservablepublic void dispose()
IObservabledispose in interface IObservablepublic final int size()
size in interface Collection<E>size in interface List<E>size in interface IObservableList<E>size in class AbstractCollection<E>protected abstract int doGetSize()
public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface List<E>isEmpty in interface IObservableList<E>isEmpty in class AbstractCollection<E>public boolean contains(Object o)
contains in interface Collection<E>contains in interface List<E>contains in interface IObservableList<E>contains in class AbstractCollection<E>public Iterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in interface List<E>iterator in interface IObservableList<E>iterator in class AbstractList<E>public Object[] toArray()
toArray in interface Collection<E>toArray in interface List<E>toArray in interface IObservableList<E>toArray in class AbstractCollection<E>public <T> T[] toArray(T[] a)
toArray in interface Collection<E>toArray in interface List<E>toArray in interface IObservableList<E>toArray in class AbstractCollection<E>public boolean add(E o)
add in interface Collection<E>add in interface List<E>add in interface IObservableList<E>add in class AbstractList<E>public E move(int oldIndex, int newIndex)
oldIndex to
newIndex. This method is equivalent to calling
add(newIndex, remove(oldIndex)).
Subclasses should override this method to deliver list change
notification for the remove and add operations in the same
ListChangeEvent, as this allows ListDiff.accept(ListDiffVisitor)
to recognize the operation as a move.
move in interface IObservableList<E>oldIndex - the element's position before the move. Must be within the
range 0 <= oldIndex < size().newIndex - the element's position after the move. Must be within the
range 0 <= newIndex < size().IndexOutOfBoundsException - if either argument is out of range (
0 <= index < size()).ListDiffVisitor.handleMove(int, int, Object),
ListDiff.accept(ListDiffVisitor)public boolean remove(Object o)
remove in interface Collection<E>remove in interface List<E>remove in interface IObservableList<E>remove in class AbstractCollection<E>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in interface List<E>containsAll in interface IObservableList<E>containsAll in class AbstractCollection<E>public boolean addAll(Collection<? extends E> c)
addAll in interface Collection<E>addAll in interface List<E>addAll in interface IObservableList<E>addAll in class AbstractCollection<E>public boolean addAll(int index,
Collection<? extends E> c)
addAll in interface List<E>addAll in interface IObservableList<E>addAll in class AbstractList<E>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<E>removeAll in interface List<E>removeAll in interface IObservableList<E>removeAll in class AbstractCollection<E>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<E>retainAll in interface List<E>retainAll in interface IObservableList<E>retainAll in class AbstractCollection<E>public boolean equals(Object o)
equals in interface Collection<E>equals in interface List<E>equals in interface IObservableList<E>equals in class AbstractList<E>public int hashCode()
hashCode in interface Collection<E>hashCode in interface List<E>hashCode in interface IObservableList<E>hashCode in class AbstractList<E>public int indexOf(Object o)
indexOf in interface List<E>indexOf in interface IObservableList<E>indexOf in class AbstractList<E>public int lastIndexOf(Object o)
lastIndexOf in interface List<E>lastIndexOf in interface IObservableList<E>lastIndexOf in class AbstractList<E>public Realm getRealm()
IObservableBecause observables can only be accessed from within one realm, and they always fire events on that realm, their state can be observed in an incremental way. It is always safe to call getters of an observable from within a change listener attached to that observable.
getRealm in interface IObservableprotected void checkRealm()
AssertionFailedException - if the realm is not the current realmRealm.isCurrent()
Copyright (c) 2000, 2017 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.