public abstract class ObservableList extends AbstractObservable implements IObservableList
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 |
wrappedList |
Modifier | Constructor and Description |
---|---|
protected |
ObservableList(List wrappedList,
Object elementType) |
protected |
ObservableList(Realm realm,
List wrappedList,
Object elementType) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Object element) |
boolean |
add(Object o) |
boolean |
addAll(Collection c) |
boolean |
addAll(int index,
Collection c) |
void |
addListChangeListener(IListChangeListener 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 diff) |
protected void |
firstListenerAdded() |
Object |
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 |
iterator() |
int |
lastIndexOf(Object o) |
protected void |
lastListenerRemoved() |
ListIterator |
listIterator() |
ListIterator |
listIterator(int index) |
Object |
move(int oldIndex,
int newIndex)
Moves the element located at
oldIndex to
newIndex . |
Object |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection c) |
void |
removeListChangeListener(IListChangeListener 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) |
Object |
set(int index,
Object element) |
void |
setStale(boolean stale)
Sets the stale state.
|
int |
size() |
List |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
Object[] |
toArray(Object[] a) |
String |
toString() |
protected void |
updateWrappedList(List 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
protected List wrappedList
public void addListChangeListener(IListChangeListener listener)
IObservableList
addListChangeListener
in interface IObservableList
public void removeListChangeListener(IListChangeListener listener)
IObservableList
removeListChangeListener
in interface IObservableList
protected void fireListChange(ListDiff diff)
public boolean contains(Object o)
contains
in interface Collection
contains
in interface List
contains
in interface IObservableList
public boolean containsAll(Collection c)
containsAll
in interface Collection
containsAll
in interface List
containsAll
in interface IObservableList
public boolean equals(Object o)
equals
in interface Collection
equals
in interface List
equals
in interface IObservableList
equals
in class Object
public int hashCode()
hashCode
in interface Collection
hashCode
in interface List
hashCode
in interface IObservableList
hashCode
in class Object
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface List
isEmpty
in interface IObservableList
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface List
iterator
in interface IObservableList
public int size()
size
in interface Collection
size
in interface List
size
in interface IObservableList
public Object[] toArray()
toArray
in interface Collection
toArray
in interface List
toArray
in interface IObservableList
public Object[] toArray(Object[] a)
toArray
in interface Collection
toArray
in interface List
toArray
in interface IObservableList
public Object get(int index)
get
in interface List
get
in interface IObservableList
public int indexOf(Object o)
indexOf
in interface List
indexOf
in interface IObservableList
public int lastIndexOf(Object o)
lastIndexOf
in interface List
lastIndexOf
in interface IObservableList
public ListIterator listIterator()
listIterator
in interface List
listIterator
in interface IObservableList
public ListIterator listIterator(int index)
listIterator
in interface List
listIterator
in interface IObservableList
public List subList(int fromIndex, int toIndex)
subList
in interface List
subList
in interface IObservableList
protected void getterCalled()
public Object set(int index, Object element)
set
in interface List
set
in interface IObservableList
public Object 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
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 Object remove(int index)
remove
in interface List
remove
in interface IObservableList
public boolean add(Object o)
add
in interface Collection
add
in interface List
add
in interface IObservableList
public boolean addAll(Collection c)
addAll
in interface Collection
addAll
in interface List
addAll
in interface IObservableList
public boolean addAll(int index, Collection c)
addAll
in interface List
addAll
in interface IObservableList
public boolean remove(Object o)
remove
in interface Collection
remove
in interface List
remove
in interface IObservableList
public boolean removeAll(Collection c)
removeAll
in interface Collection
removeAll
in interface List
removeAll
in interface IObservableList
public boolean retainAll(Collection c)
retainAll
in interface Collection
retainAll
in interface List
retainAll
in interface IObservableList
public void clear()
clear
in interface Collection
clear
in interface List
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
getElementType
in interface IObservableList
null
if untypedprotected void updateWrappedList(List newList)
protected 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, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.