Eclipse Platform
Release 3.3

org.eclipse.core.databinding.observable.value
Class AbstractObservableValue

java.lang.Object
  extended byorg.eclipse.core.databinding.observable.ChangeManager
      extended byorg.eclipse.core.databinding.observable.AbstractObservable
          extended byorg.eclipse.core.databinding.observable.value.AbstractObservableValue
All Implemented Interfaces:
IObservable, IObservableValue
Direct Known Subclasses:
AbstractVetoableValue, ComputedValue, WritableValue

public abstract class AbstractObservableValue
extends AbstractObservable
implements IObservableValue

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.

Since:
1.0

Constructor Summary
AbstractObservableValue()
          Constructs a new instance with the default realm.
AbstractObservableValue(Realm realm)
           
 
Method Summary
 void addValueChangeListener(IValueChangeListener listener)
           
 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 abstract  Object doGetValue()
           
protected  void doSetValue(Object value)
          Template method for setting the value of the observable.
protected  void fireChange()
           
protected  void fireValueChange(ValueDiff diff)
           
 Object getValue()
          Returns the value.
 boolean isStale()
          Returns whether the state of this observable is stale and is expected to change soon.
 void removeValueChangeListener(IValueChangeListener listener)
           
 void setValue(Object value)
          Sets the value.
 
Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addListener, addStaleListener, checkRealm, fireEvent, fireStale, firstListenerAdded, getRealm, hasListeners, lastListenerRemoved, removeChangeListener, removeListener, removeStaleListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.databinding.observable.value.IObservableValue
getValueType
 
Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addStaleListener, getRealm, removeChangeListener, removeStaleListener
 

Constructor Detail

AbstractObservableValue

public AbstractObservableValue()
Constructs a new instance with the default realm.


AbstractObservableValue

public AbstractObservableValue(Realm realm)
Parameters:
realm -
Method Detail

addValueChangeListener

public void addValueChangeListener(IValueChangeListener listener)
Specified by:
addValueChangeListener in interface IObservableValue
Parameters:
listener -

removeValueChangeListener

public void removeValueChangeListener(IValueChangeListener listener)
Specified by:
removeValueChangeListener in interface IObservableValue
Parameters:
listener -

setValue

public final void setValue(Object value)
Description copied from interface: IObservableValue
Sets the value. Must be invoked in the Realm of the observable.

Specified by:
setValue in interface IObservableValue
Parameters:
value - the value to set

doSetValue

protected void doSetValue(Object value)
Template method for setting the value of the observable. By default the method throws an UnsupportedOperationException.

Parameters:
value -

fireValueChange

protected void fireValueChange(ValueDiff diff)

getValue

public final Object getValue()
Description copied from interface: IObservableValue
Returns the value. Must be invoked in the Realm of the observable.

Specified by:
getValue in interface IObservableValue
Returns:
the current value

doGetValue

protected abstract Object doGetValue()

isStale

public boolean isStale()
Description copied from interface: IObservable
Returns whether the state of this observable is stale and is expected to change soon. A non-stale observable that becomes stale will notify its stale listeners. A stale object that becomes non-stale does so by changing its state and notifying its change listeners, it does not notify its stale listeners about becoming non-stale. Clients that do not expect asynchronous changes may ignore staleness of observable objects.

Specified by:
isStale in interface IObservable
Returns:
true if this observable's state is stale and will change soon.

fireChange

protected void fireChange()
Overrides:
fireChange in class AbstractObservable

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 interface IObservable
Overrides:
dispose in class AbstractObservable

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.