Class DecoratingObservableSet<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.set.DecoratingObservableSet<E>
-
- Type Parameters:
E
- the type of the elements in this set
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<E>
,IDecoratingObservable
,IObservable
,IObservableCollection<E>
,IObservableSet<E>
public class DecoratingObservableSet<E> extends DecoratingObservableCollection<E> implements IObservableSet<E>
An observable set which decorates another observable set.- 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
Constructors Constructor Description DecoratingObservableSet(IObservableSet<E> decorated, boolean disposeDecoratedOnDispose)
Constructs a DecoratingObservableSet which decorates the given observable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addListener(Object listenerType, IObservablesListener listener)
void
addSetChangeListener(ISetChangeListener<? super E> listener)
void
clear()
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
fireChange()
protected void
fireEvent(ObservableEvent event)
protected void
fireSetChange(SetDiff<E> diff)
protected void
firstListenerAdded()
Realm
getRealm()
protected void
handleSetChange(SetChangeEvent<? extends E> event)
Called whenever a SetChangeEvent is received from the decorated observable.protected boolean
hasListeners()
protected void
lastListenerRemoved()
protected void
removeListener(Object listenerType, IObservablesListener listener)
void
removeSetChangeListener(ISetChangeListener<? super E> listener)
-
Methods inherited from class org.eclipse.core.databinding.observable.DecoratingObservableCollection
add, addAll, 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.set.IObservableSet
add, addAll, contains, containsAll, equals, getElementType, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from interface java.util.Set
spliterator
-
-
-
-
Constructor Detail
-
DecoratingObservableSet
public DecoratingObservableSet(IObservableSet<E> decorated, boolean disposeDecoratedOnDispose)
Constructs a DecoratingObservableSet which decorates the given observable.- Parameters:
decorated
- the observable set being decorateddisposeDecoratedOnDispose
- whether the decorated observable should be disposed when the decorator is disposed
-
-
Method Detail
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceSet<E>
- Overrides:
clear
in classDecoratingObservableCollection<E>
-
addSetChangeListener
public void addSetChangeListener(ISetChangeListener<? super E> listener)
- Specified by:
addSetChangeListener
in interfaceIObservableSet<E>
- Parameters:
listener
- the change listener to add; notnull
-
removeSetChangeListener
public void removeSetChangeListener(ISetChangeListener<? super E> listener)
- Specified by:
removeSetChangeListener
in interfaceIObservableSet<E>
- Parameters:
listener
- the change listener to remove; notnull
-
fireChange
protected void fireChange()
- Overrides:
fireChange
in classAbstractObservable
-
firstListenerAdded
protected void firstListenerAdded()
- Overrides:
firstListenerAdded
in classDecoratingObservable
-
lastListenerRemoved
protected void lastListenerRemoved()
- Overrides:
lastListenerRemoved
in classDecoratingObservable
-
handleSetChange
protected void handleSetChange(SetChangeEvent<? extends E> event)
Called whenever a SetChangeEvent is received from the decorated observable. By default, this method fires the set 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
-
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
protected void addListener(Object listenerType, IObservablesListener listener)
- Parameters:
listenerType
- arbitrary object to identify a type of the listenerlistener
- the listener to add; notnull
-
removeListener
protected void removeListener(Object listenerType, IObservablesListener listener)
- Parameters:
listenerType
- arbitrary object to identify a type of the listenerlistener
- the listener to remove; notnull
-
hasListeners
protected boolean hasListeners()
-
fireEvent
protected void fireEvent(ObservableEvent event)
-
getRealm
public Realm getRealm()
- Returns:
- Returns the realm.
-
clone
protected Object clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
-