E
- the type of the elements in this listpublic class WritableList<E> extends ObservableList<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.
wrappedList
Constructor and Description |
---|
WritableList()
Creates an empty writable list in the default realm with a
null element type. |
WritableList(Collection<E> collection,
Object elementType)
Constructs a new instance in the default realm containing the elements of
the given collection.
|
WritableList(List<E> toWrap,
Object elementType)
Constructs a new instance with the default realm.
|
WritableList(Realm realm)
Creates an empty writable list with a
null element type. |
WritableList(Realm realm,
Collection<E> collection,
Object elementType)
Constructs a new instance in the default realm containing the elements of
the given collection.
|
WritableList(Realm realm,
List<E> toWrap,
Object elementType)
Creates a writable list containing elements of the given type, wrapping
an existing client-supplied list.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E element) |
void |
add(int index,
E element) |
boolean |
addAll(Collection<? extends E> c) |
boolean |
addAll(int index,
Collection<? extends E> c) |
protected void |
addListener(Object listenerType,
IObservablesListener listener) |
void |
clear() |
protected Object |
clone() |
protected void |
fireEvent(ObservableEvent event) |
protected void |
firstListenerAdded() |
Realm |
getRealm() |
protected boolean |
hasListeners() |
protected void |
lastListenerRemoved() |
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) |
protected void |
removeListener(Object listenerType,
IObservablesListener listener) |
boolean |
retainAll(Collection<?> c) |
E |
set(int index,
E element) |
static <T> WritableList<T> |
withElementType(Object elementType) |
addListChangeListener, contains, containsAll, dispose, equals, fireChange, fireListChange, get, getElementType, getterCalled, hashCode, indexOf, isEmpty, isStale, iterator, lastIndexOf, listIterator, listIterator, removeListChangeListener, setStale, size, subList, toArray, toArray, toString, updateWrappedList
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 WritableList()
null
element type.public WritableList(Realm realm)
null
element type.realm
- the observable's realmpublic WritableList(List<E> toWrap, Object elementType)
WritableList(Collection, Object)
should be used by casting the
first argument to Collection
.toWrap
- The java.util.List to wrapelementType
- can be null
public WritableList(Collection<E> collection, Object elementType)
collection
- the collection to copyelementType
- can be null
public WritableList(Realm realm, List<E> toWrap, Object elementType)
WritableList(Realm, Collection, Object)
should be used by
casting the second argument to Collection
.realm
- the observable's realmtoWrap
- The java.util.List to wrapelementType
- can be null
public WritableList(Realm realm, Collection<E> collection, Object elementType)
realm
- the observable's realmcollection
- the collection to copyelementType
- can be null
public E set(int index, E element)
set
in interface List<E>
set
in interface IObservableList<E>
set
in class ObservableList<E>
public E move(int oldIndex, int newIndex)
ObservableList
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>
move
in class ObservableList<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()
.ListDiffVisitor.handleMove(int, int, Object)
,
ListDiff.accept(ListDiffVisitor)
public E remove(int index)
remove
in interface List<E>
remove
in interface IObservableList<E>
remove
in class ObservableList<E>
public boolean add(E element)
add
in interface Collection<E>
add
in interface List<E>
add
in interface IObservableList<E>
add
in class ObservableList<E>
public void add(int index, E element)
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 ObservableList<E>
public boolean addAll(int index, Collection<? extends E> c)
addAll
in interface List<E>
addAll
in interface IObservableList<E>
addAll
in class ObservableList<E>
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface List<E>
remove
in interface IObservableList<E>
remove
in class ObservableList<E>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<E>
removeAll
in interface List<E>
removeAll
in interface IObservableList<E>
removeAll
in class ObservableList<E>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<E>
retainAll
in interface List<E>
retainAll
in interface IObservableList<E>
retainAll
in class ObservableList<E>
public void clear()
clear
in interface Collection<E>
clear
in interface List<E>
clear
in class ObservableList<E>
public static <T> WritableList<T> withElementType(Object elementType)
elementType
- can be null
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, 2016 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.