T
- the type of value being observedpublic abstract class AbstractObservableValue<T> extends AbstractObservable implements IObservableValue<T>
This class is thread safe. All state accessing methods must be invoked from
the current realm
. Methods for adding and removing
listeners may be invoked from any thread.
Constructor and Description |
---|
AbstractObservableValue()
Constructs a new instance with the default realm.
|
AbstractObservableValue(Realm realm) |
Modifier and Type | Method and Description |
---|---|
protected void |
addListener(Object listenerType,
IObservablesListener listener) |
void |
addValueChangeListener(IValueChangeListener<? super T> listener) |
protected Object |
clone() |
protected abstract T |
doGetValue() |
protected void |
doSetValue(T value)
Template method for setting the value of the observable.
|
protected void |
fireChange() |
protected void |
fireEvent(ObservableEvent event) |
protected void |
fireValueChange(ValueDiff<T> diff) |
protected void |
firstListenerAdded() |
Realm |
getRealm() |
T |
getValue()
Returns the value.
|
protected boolean |
hasListeners() |
boolean |
isStale()
Returns whether the state of this observable is stale and is expected to
change soon.
|
protected void |
lastListenerRemoved() |
protected void |
removeListener(Object listenerType,
IObservablesListener listener) |
void |
removeValueChangeListener(IValueChangeListener<? super T> listener) |
void |
setValue(T value)
Sets the value.
|
addChangeListener, addDisposeListener, addStaleListener, checkRealm, dispose, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getValueType
addChangeListener, addDisposeListener, addStaleListener, dispose, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
public AbstractObservableValue()
public AbstractObservableValue(Realm realm)
realm
- public void addValueChangeListener(IValueChangeListener<? super T> listener)
addValueChangeListener
in interface IObservableValue<T>
public void removeValueChangeListener(IValueChangeListener<? super T> listener)
removeValueChangeListener
in interface IObservableValue<T>
public final void setValue(T value)
IObservableValue
Realm
of the observable.setValue
in interface IObservableValue<T>
value
- the value to setprotected void doSetValue(T value)
UnsupportedOperationException
.value
- public final T getValue()
IObservableValue
Realm
of the
observable.getValue
in interface IObservableValue<T>
protected abstract T doGetValue()
public boolean isStale()
IObservable
isStale
in interface IObservable
protected void fireChange()
fireChange
in class AbstractObservable
protected void addListener(Object listenerType, IObservablesListener listener)
listenerType
- listener
- protected void removeListener(Object listenerType, IObservablesListener listener)
listenerType
- listener
- protected boolean hasListeners()
protected void fireEvent(ObservableEvent event)
protected void firstListenerAdded()
protected void lastListenerRemoved()
public Realm getRealm()
protected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Copyright (c) 2000, 2016 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.