T
- the type of value being observedpublic class WritableValue<T> extends AbstractObservableValue<T>
IObservableValue
that will
maintain a value and fire change events when the value changes.
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 |
---|
WritableValue()
Constructs a new instance with the default realm, a
null
value type, and a null value. |
WritableValue(Realm realm)
Constructs a new instance with the provided
realm , a
null value type, and a null initial value. |
WritableValue(Realm realm,
T initialValue,
Object valueType)
Constructs a new instance.
|
WritableValue(T initialValue,
Object valueType)
Constructs a new instance with the default realm.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addListener(Object listenerType,
IObservablesListener listener) |
protected Object |
clone() |
T |
doGetValue() |
void |
doSetValue(T value)
Template method for setting the value of the observable.
|
protected void |
fireEvent(ObservableEvent event) |
protected void |
firstListenerAdded() |
Realm |
getRealm() |
Object |
getValueType()
The value type of this observable value, or
null if this
observable value is untyped. |
protected boolean |
hasListeners() |
protected void |
lastListenerRemoved() |
protected void |
removeListener(Object listenerType,
IObservablesListener listener) |
static <T2> WritableValue<T2> |
withValueType(Object elementType) |
addValueChangeListener, fireChange, fireValueChange, getValue, isStale, removeValueChangeListener, setValue
addChangeListener, addDisposeListener, addStaleListener, checkRealm, dispose, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addChangeListener, addDisposeListener, addStaleListener, dispose, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
public WritableValue()
null
value type, and a null
value.public WritableValue(T initialValue, Object valueType)
initialValue
- can be null
valueType
- can be null
public WritableValue(Realm realm)
realm
, a
null
value type, and a null
initial value.realm
- public T doGetValue()
doGetValue
in class AbstractObservableValue<T>
public void doSetValue(T value)
AbstractObservableValue
UnsupportedOperationException
.doSetValue
in class AbstractObservableValue<T>
value
- The value to set.public Object getValueType()
IObservableValue
null
if this
observable value is untyped.null
public static <T2> WritableValue<T2> withValueType(Object elementType)
T2
- elementType
- can be null
null
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.