Class DecoratingObservableList<E>
java.lang.Object
org.eclipse.core.databinding.observable.AbstractObservable
org.eclipse.core.databinding.observable.DecoratingObservable
org.eclipse.core.databinding.observable.DecoratingObservableCollection<E>
org.eclipse.core.databinding.observable.list.DecoratingObservableList<E>
- Type Parameters:
E
- the list element type
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,List<E>
,IDecoratingObservable
,IObservable
,IObservableCollection<E>
,IObservableList<E>
public class DecoratingObservableList<E>
extends DecoratingObservableCollection<E>
implements IObservableList<E>
An observable list which decorates another observable list.
- Since:
- 1.2
- Implementation Note:
- If methods are added to the interface which this class implements then implementations of those methods must be added to this class.
-
Constructor Summary
ConstructorDescriptionDecoratingObservableList
(IObservableList<E> decorated, boolean disposeDecoratedOnDispose) Constructs a DecoratingObservableList which decorates the given observable. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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) protected Object
clone()
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 void
protected void
fireEvent
(ObservableEvent event) protected void
fireListChange
(ListDiff<E> diff) protected void
get
(int index) getRealm()
protected void
handleListChange
(ListChangeEvent<? extends E> event) Called whenever a ListChangeEvent is received from the decorated observable.protected boolean
int
int
protected void
listIterator
(int index) move
(int oldIndex, int newIndex) Moves the element located atoldIndex
tonewIndex
.remove
(int index) 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) subList
(int fromIndex, int toIndex) Methods inherited from class org.eclipse.core.databinding.observable.DecoratingObservableCollection
add, addAll, clear, contains, containsAll, equals, getElementType, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString
Methods inherited from class org.eclipse.core.databinding.observable.DecoratingObservable
getDecorated, getterCalled, handleStaleEvent, isStale
Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addDisposeListener, addStaleListener, checkRealm, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addDisposeListener, addStaleListener, getRealm, isDisposed, isStale, removeChangeListener, removeDisposeListener, removeStaleListener
Methods inherited from interface org.eclipse.core.databinding.observable.list.IObservableList
add, addAll, contains, containsAll, equals, getElementType, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
Methods inherited from interface java.util.List
clear, replaceAll, sort, spliterator
-
Constructor Details
-
DecoratingObservableList
Constructs a DecoratingObservableList which decorates the given observable.- Parameters:
decorated
- the observable list being decorateddisposeDecoratedOnDispose
- whether the decorated observable should be disposed when the decorator is disposed
-
-
Method Details
-
addListChangeListener
Description copied from interface:IObservableList
Adds the given list change listener to the list of list change listeners.- Specified by:
addListChangeListener
in interfaceIObservableList<E>
- Parameters:
listener
- the change listener to add; notnull
-
removeListChangeListener
Description copied from interface:IObservableList
Removes the given list change listener from the list of list change listeners. Has no effect if the given listener is not registered as a list change listener.- Specified by:
removeListChangeListener
in interfaceIObservableList<E>
- Parameters:
listener
- the change listener to remove; notnull
-
fireListChange
-
fireChange
protected void fireChange()- Overrides:
fireChange
in classAbstractObservable
-
firstListenerAdded
protected void firstListenerAdded()- Overrides:
firstListenerAdded
in classDecoratingObservable
-
lastListenerRemoved
protected void lastListenerRemoved()- Overrides:
lastListenerRemoved
in classDecoratingObservable
-
handleListChange
Called whenever a ListChangeEvent is received from the decorated observable. By default, this method fires the list change event again, with the decorating observable as the event source. Subclasses may override to provide different behavior.- Parameters:
event
- the change event received from the decorated observable
-
add
-
addAll
-
get
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceIObservableList<E>
- Specified by:
lastIndexOf
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceIObservableList<E>
- Specified by:
listIterator
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceIObservableList<E>
- Specified by:
listIterator
in interfaceList<E>
-
move
Description copied from interface:IObservableList
Moves the element located atoldIndex
tonewIndex
. This method is equivalent to callingadd(newIndex, remove(oldIndex))
.Implementors should 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.- Specified by:
move
in interfaceIObservableList<E>
- Parameters:
oldIndex
- the element's position before the move. Must be within the range0 <= oldIndex < size()
.newIndex
- the element's position after the move. Must be within the range0 <= newIndex < size()
.- Returns:
- the element that was moved.
- See Also:
-
remove
-
set
-
subList
-
dispose
public void dispose()Description copied from interface:IObservable
Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.- Specified by:
dispose
in interfaceIObservable
- Overrides:
dispose
in classDecoratingObservableCollection<E>
-
addListener
- Parameters:
listenerType
- arbitrary object to identify a type of the listenerlistener
- the listener to add; notnull
-
removeListener
- Parameters:
listenerType
- arbitrary object to identify a type of the listenerlistener
- the listener to remove; notnull
-
hasListeners
protected boolean hasListeners() -
fireEvent
-
getRealm
- Returns:
- Returns the realm.
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-