public class WritableList extends ObservableList
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 collection,
Object elementType)
Constructs a new instance in the default realm containing the elements of
the given collection.
|
WritableList(List 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 collection,
Object elementType)
Constructs a new instance in the default realm containing the elements of
the given collection.
|
WritableList(Realm realm,
List 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 |
---|---|
void |
add(int index,
Object element) |
boolean |
add(Object element) |
boolean |
addAll(Collection c) |
boolean |
addAll(int index,
Collection 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() |
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) |
protected void |
removeListener(Object listenerType,
IObservablesListener listener) |
boolean |
retainAll(Collection c) |
Object |
set(int index,
Object element) |
static WritableList |
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
addChangeListener, addDisposeListener, addStaleListener, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
public WritableList()
null
element type.public WritableList(Realm realm)
null
element type.realm
- the observable's realmpublic WritableList(List 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 collection, Object elementType)
collection
- the collection to copyelementType
- can be null
public WritableList(Realm realm, List 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 collection, Object elementType)
realm
- the observable's realmcollection
- the collection to copyelementType
- can be null
public Object set(int index, Object element)
set
in interface List
set
in interface IObservableList
set
in class ObservableList
public Object 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
move
in class ObservableList
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 Object remove(int index)
remove
in interface List
remove
in interface IObservableList
remove
in class ObservableList
public boolean add(Object element)
add
in interface Collection
add
in interface List
add
in interface IObservableList
add
in class ObservableList
public void add(int index, Object element)
add
in interface List
add
in class ObservableList
public boolean addAll(Collection c)
addAll
in interface Collection
addAll
in interface List
addAll
in interface IObservableList
addAll
in class ObservableList
public boolean addAll(int index, Collection c)
addAll
in interface List
addAll
in interface IObservableList
addAll
in class ObservableList
public boolean remove(Object o)
remove
in interface Collection
remove
in interface List
remove
in interface IObservableList
remove
in class ObservableList
public boolean removeAll(Collection c)
removeAll
in interface Collection
removeAll
in interface List
removeAll
in interface IObservableList
removeAll
in class ObservableList
public boolean retainAll(Collection c)
retainAll
in interface Collection
retainAll
in interface List
retainAll
in interface IObservableList
retainAll
in class ObservableList
public void clear()
clear
in interface Collection
clear
in interface List
clear
in class ObservableList
public static WritableList 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, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.