E
- the type of the elements in this listpublic abstract class ObservableList<E> extends AbstractObservable implements IObservableList<E>
IObservableList
, based on an underlying
regular list.
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.
Modifier and Type | Field and Description |
---|---|
protected List<E> |
wrappedList |
Modifier | Constructor and Description |
---|---|
protected |
ObservableList(List<E> wrappedList,
Object elementType) |
protected |
ObservableList(Realm realm,
List<E> wrappedList,
Object elementType) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E o) |
void |
add(int index,
E element) |
boolean |
addAll(Collection<? extends E> c) |
boolean |
addAll(int index,
Collection<? extends E> c) |
void |
addListChangeListener(IListChangeListener<? super E> listener)
Adds the given list change listener to the list of list change listeners.
|
protected void |
addListener(Object listenerType,
IObservablesListener listener) |
void |
clear() |
protected Object |
clone() |
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.
|
boolean |
equals(Object o) |
protected void |
fireChange() |
protected void |
fireEvent(ObservableEvent event) |
protected void |
fireListChange(ListDiff<E> diff) |
protected void |
firstListenerAdded() |
E |
get(int index) |
Object |
getElementType()
Returns the element type of this observable collection, or
null if this observable collection is untyped. |
Realm |
getRealm() |
protected void |
getterCalled() |
int |
hashCode() |
protected boolean |
hasListeners() |
int |
indexOf(Object o) |
boolean |
isEmpty() |
boolean |
isStale()
Returns the stale state.
|
Iterator<E> |
iterator() |
int |
lastIndexOf(Object o) |
protected void |
lastListenerRemoved() |
ListIterator<E> |
listIterator() |
ListIterator<E> |
listIterator(int index) |
E |
move(int oldIndex,
int newIndex)
Moves the element located at
oldIndex to
newIndex . |
E |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
void |
removeListChangeListener(IListChangeListener<? super E> listener)
Removes the given list change listener from the list of list change
listeners.
|
protected void |
removeListener(Object listenerType,
IObservablesListener listener) |
boolean |
retainAll(Collection<?> c) |
E |
set(int index,
E element) |
void |
setStale(boolean stale)
Sets the stale state.
|
int |
size() |
List<E> |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString() |
protected void |
updateWrappedList(List<E> newList) |
addChangeListener, addDisposeListener, addStaleListener, checkRealm, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
finalize, getClass, notify, notifyAll, wait, wait, wait
replaceAll, sort, spliterator
addChangeListener, addDisposeListener, addStaleListener, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
parallelStream, removeIf, stream
public void addListChangeListener(IListChangeListener<? super E> listener)
IObservableList
addListChangeListener
in interface IObservableList<E>
public void removeListChangeListener(IListChangeListener<? super E> listener)
IObservableList
removeListChangeListener
in interface IObservableList<E>
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in interface List<E>
contains
in interface IObservableList<E>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface List<E>
containsAll
in interface IObservableList<E>
public boolean equals(Object o)
public int hashCode()
public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in interface List<E>
isEmpty
in interface IObservableList<E>
public int size()
size
in interface Collection<E>
size
in interface List<E>
size
in interface IObservableList<E>
public Object[] toArray()
toArray
in interface Collection<E>
toArray
in interface List<E>
toArray
in interface IObservableList<E>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<E>
toArray
in interface List<E>
toArray
in interface IObservableList<E>
public E get(int index)
public int indexOf(Object o)
public int lastIndexOf(Object o)
lastIndexOf
in interface List<E>
lastIndexOf
in interface IObservableList<E>
public ListIterator<E> listIterator()
listIterator
in interface List<E>
listIterator
in interface IObservableList<E>
public ListIterator<E> listIterator(int index)
listIterator
in interface List<E>
listIterator
in interface IObservableList<E>
protected void getterCalled()
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 E remove(int index)
public boolean add(E o)
add
in interface Collection<E>
add
in interface List<E>
add
in interface IObservableList<E>
public boolean addAll(Collection<? extends E> c)
addAll
in interface Collection<E>
addAll
in interface List<E>
addAll
in interface IObservableList<E>
public boolean addAll(int index, Collection<? extends E> c)
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface List<E>
remove
in interface IObservableList<E>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<E>
removeAll
in interface List<E>
removeAll
in interface IObservableList<E>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<E>
retainAll
in interface List<E>
retainAll
in interface IObservableList<E>
public void clear()
public boolean isStale()
isStale
in interface IObservable
public void setStale(boolean stale)
stale
- The stale state to list. This will fire a stale event if the
given boolean is true and this observable list was not already
stale.protected void fireChange()
fireChange
in class AbstractObservable
public void dispose()
IObservable
dispose
in interface IObservable
dispose
in class AbstractObservable
public Object getElementType()
IObservableCollection
null
if this observable collection is untyped.getElementType
in interface IObservableCollection<E>
getElementType
in interface IObservableList<E>
null
if untypedprotected void addListener(Object listenerType, IObservablesListener listener)
listenerType
- listener
- protected void removeListener(Object listenerType, IObservablesListener listener)
listenerType
- listener
- protected boolean hasListeners()
protected void fireEvent(ObservableEvent event)
protected void firstListenerAdded()
protected void lastListenerRemoved()
public Realm getRealm()
protected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Copyright (c) 2000, 2016 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.