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>,SequencedCollection<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
ConstructorsConstructorDescriptionDecoratingObservableList(IObservableList<E> decorated, boolean disposeDecoratedOnDispose) Constructs a DecoratingObservableList which decorates the given observable. -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanaddAll(int index, Collection<? extends E> c) voidaddListChangeListener(IListChangeListener<? super E> listener) Adds the given list change listener to the list of list change listeners.protected voidaddListener(Object listenerType, IObservablesListener listener) protected Objectclone()voiddispose()Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.protected voidprotected voidfireEvent(ObservableEvent event) protected voidfireListChange(ListDiff<E> diff) protected voidget(int index) getRealm()protected voidhandleListChange(ListChangeEvent<? extends E> event) Called whenever a ListChangeEvent is received from the decorated observable.protected booleanintintprotected voidlistIterator(int index) move(int oldIndex, int newIndex) Moves the element located atoldIndextonewIndex.remove(int index) voidremoveListChangeListener(IListChangeListener<? super E> listener) Removes the given list change listener from the list of list change listeners.protected voidremoveListener(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, toStringMethods inherited from class org.eclipse.core.databinding.observable.DecoratingObservable
getDecorated, getterCalled, handleStaleEvent, isStaleMethods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addDisposeListener, addStaleListener, checkRealm, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListenerMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addDisposeListener, addStaleListener, getRealm, isDisposed, isStale, removeChangeListener, removeDisposeListener, removeStaleListenerMethods inherited from interface org.eclipse.core.databinding.observable.list.IObservableList
add, addAll, contains, containsAll, equals, getElementType, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArrayMethods inherited from interface java.util.List
addFirst, addLast, clear, getFirst, getLast, removeFirst, removeLast, replaceAll, reversed, 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:IObservableListAdds the given list change listener to the list of list change listeners.- Specified by:
addListChangeListenerin interfaceIObservableList<E>- Parameters:
listener- the change listener to add; notnull
-
removeListChangeListener
Description copied from interface:IObservableListRemoves 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:
removeListChangeListenerin interfaceIObservableList<E>- Parameters:
listener- the change listener to remove; notnull
-
fireListChange
-
fireChange
protected void fireChange()- Overrides:
fireChangein classAbstractObservable
-
firstListenerAdded
protected void firstListenerAdded()- Overrides:
firstListenerAddedin classDecoratingObservable
-
lastListenerRemoved
protected void lastListenerRemoved()- Overrides:
lastListenerRemovedin 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:
lastIndexOfin interfaceIObservableList<E>- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceIObservableList<E>- Specified by:
listIteratorin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceIObservableList<E>- Specified by:
listIteratorin interfaceList<E>
-
move
Description copied from interface:IObservableListMoves the element located atoldIndextonewIndex. 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:
movein 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:IObservableDisposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.- Specified by:
disposein interfaceIObservable- Overrides:
disposein 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:
clonein classObject- Throws:
CloneNotSupportedException
-