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
-
-
Constructor Summary
Constructors Constructor Description DecoratingObservableValue(IObservableValue<T> decorated, boolean disposeDecoratedOnDispose)Constructs a DecoratingObservableValue which decorates the given observable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddListener(Object listenerType, IObservablesListener listener)voidaddValueChangeListener(IValueChangeListener<? super T> 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 voidfireChange()protected voidfireEvent(ObservableEvent event)protected voidfireValueChange(ValueDiff<T> diff)protected voidfirstListenerAdded()RealmgetRealm()TgetValue()Returns the value.ObjectgetValueType()The value type of this observable value, ornullif this observable value is untyped.protected voidhandleValueChange(ValueChangeEvent<? extends T> event)Called whenever a ValueChangeEvent is received from the decorated observable.protected booleanhasListeners()protected voidlastListenerRemoved()protected voidremoveListener(Object listenerType, IObservablesListener listener)voidremoveValueChangeListener(IValueChangeListener<? super T> listener)voidsetValue(T value)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 Detail
-
DecoratingObservableValue
public DecoratingObservableValue(IObservableValue<T> decorated, boolean disposeDecoratedOnDispose)
Constructs a DecoratingObservableValue which decorates the given observable.- Parameters:
decorated- the observable value being decorateddisposeDecoratedOnDispose-
-
-
Method Detail
-
addValueChangeListener
public void addValueChangeListener(IValueChangeListener<? super T> listener)
- Specified by:
addValueChangeListenerin interfaceIObservableValue<T>
-
removeValueChangeListener
public void removeValueChangeListener(IValueChangeListener<? super T> listener)
- Specified by:
removeValueChangeListenerin interfaceIObservableValue<T>
-
fireChange
protected void fireChange()
- Overrides:
fireChangein classAbstractObservable
-
firstListenerAdded
protected void firstListenerAdded()
- Overrides:
firstListenerAddedin classDecoratingObservable
-
lastListenerRemoved
protected void lastListenerRemoved()
- Overrides:
lastListenerRemovedin classDecoratingObservable
-
handleValueChange
protected void handleValueChange(ValueChangeEvent<? extends T> event)
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
public T getValue()
Description copied from interface:IObservableValueReturns the value. Must be invoked in theRealmof the observable.- Specified by:
getValuein interfaceIObservableValue<T>- Returns:
- the current value
-
setValue
public void setValue(T value)
Description copied from interface:IObservableValueSets the value. Must be invoked in theRealmof the observable.- Specified by:
setValuein interfaceIObservableValue<T>- Parameters:
value- the value to set
-
getValueType
public Object getValueType()
Description copied from interface:IObservableValueThe value type of this observable value, ornullif this observable value is untyped.- Specified by:
getValueTypein interfaceIObservableValue<T>- Returns:
- the value type, or
null
-
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 classDecoratingObservable
-
addListener
protected void addListener(Object listenerType, IObservablesListener listener)
- Parameters:
listenerType-listener-
-
removeListener
protected void removeListener(Object listenerType, IObservablesListener listener)
- Parameters:
listenerType-listener-
-
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:
clonein classObject- Throws:
CloneNotSupportedException
-
-