Class DecoratingObservableValue<T>
java.lang.Object
org.eclipse.core.databinding.observable.AbstractObservable
org.eclipse.core.databinding.observable.DecoratingObservable
org.eclipse.core.databinding.observable.value.DecoratingObservableValue<T>
- Type Parameters:
T
- the type of value being observed
- All Implemented Interfaces:
IDecoratingObservable
,IObservable
,IObservableValue<T>
- Direct Known Subclasses:
DecoratingVetoableValue
public class DecoratingObservableValue<T>
extends DecoratingObservable
implements IObservableValue<T>
An observable value which decorates another observable value.
- 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
ConstructorDescriptionDecoratingObservableValue
(IObservableValue<T> decorated, boolean disposeDecoratedOnDispose) Constructs a DecoratingObservableValue which decorates the given observable. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addListener
(Object listenerType, IObservablesListener listener) void
addValueChangeListener
(IValueChangeListener<? super T> 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
fireValueChange
(ValueDiff<T> diff) protected void
getRealm()
getValue()
Returns the value.The value type of this observable value, ornull
if this observable value is untyped.protected void
handleValueChange
(ValueChangeEvent<? extends T> event) Called whenever a ValueChangeEvent is received from the decorated observable.protected boolean
protected void
protected void
removeListener
(Object listenerType, IObservablesListener listener) void
removeValueChangeListener
(IValueChangeListener<? super T> listener) void
Sets the value.Methods inherited from class org.eclipse.core.databinding.observable.DecoratingObservable
equals, getDecorated, getterCalled, handleStaleEvent, hashCode, 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, toString, wait, wait, wait
Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addDisposeListener, addStaleListener, getRealm, isDisposed, isStale, removeChangeListener, removeDisposeListener, removeStaleListener
-
Constructor Details
-
DecoratingObservableValue
Constructs a DecoratingObservableValue which decorates the given observable.- Parameters:
decorated
- the observable value being decorateddisposeDecoratedOnDispose
- whether the decorated observable should be disposed when the decorator is disposed
-
-
Method Details
-
addValueChangeListener
- Specified by:
addValueChangeListener
in interfaceIObservableValue<T>
- Parameters:
listener
- the change listener to add; notnull
-
removeValueChangeListener
- Specified by:
removeValueChangeListener
in interfaceIObservableValue<T>
- Parameters:
listener
- the change listener to remove; notnull
-
fireValueChange
-
fireChange
protected void fireChange()- Overrides:
fireChange
in classAbstractObservable
-
firstListenerAdded
protected void firstListenerAdded()- Overrides:
firstListenerAdded
in classDecoratingObservable
-
lastListenerRemoved
protected void lastListenerRemoved()- Overrides:
lastListenerRemoved
in classDecoratingObservable
-
handleValueChange
Called whenever a ValueChangeEvent is received from the decorated observable. By default, this method fires the value 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
-
getValue
Description copied from interface:IObservableValue
Returns the value. Must be invoked in theRealm
of the observable.- Specified by:
getValue
in interfaceIObservableValue<T>
- Returns:
- the current value
-
setValue
Description copied from interface:IObservableValue
Sets the value. Must be invoked in theRealm
of the observable.- Specified by:
setValue
in interfaceIObservableValue<T>
- Parameters:
value
- the value to set
-
getValueType
Description copied from interface:IObservableValue
The value type of this observable value, ornull
if this observable value is untyped.- Specified by:
getValueType
in interfaceIObservableValue<T>
- Returns:
- the value type, or
null
-
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 classDecoratingObservable
-
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
-