org.eclipse.core.databinding.observable
Interface IObservable
- All Known Subinterfaces:
- IObservableCollection, IObservableList, IObservableMap, IObservableSet, IObservableValue, ISWTObservable, ISWTObservableValue, IVetoableValue, IViewerObservable, IViewerObservableList, IViewerObservableSet, IViewerObservableValue
- All Known Implementing Classes:
- AbstractObservable, AbstractObservableList, AbstractObservableMap, AbstractObservableSet, AbstractObservableValue, AbstractVetoableValue, AggregateValidationStatus, ObservableList, ObservableMap, ObservableSet
- public interface IObservable
An object with state that allows to listen for state changes.
Implementations must not manage listeners themselves, listener management
must be delegated to a private instance of type ChangeSupport
if it
is not inherited from AbstractObservable
.
- Since:
- 1.0
- Restriction
- This interface is not intended to be implemented by clients.
Clients should instead subclass one of the classes in the
framework that implement this interface. Note that direct
implementers of this interface outside of the framework will be
broken in future releases when methods are added to this
interface.
- Restriction
- This interface is not intended to be extended by clients.
Method Summary |
void |
addChangeListener(IChangeListener listener)
Adds the given change listener to the list of change listeners. |
void |
addStaleListener(IStaleListener listener)
Adds the given stale listener to the list of stale listeners. |
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. |
Realm |
getRealm()
Returns the realm for this observable. |
boolean |
isStale()
Returns whether the state of this observable is stale and is expected to
change soon. |
void |
removeChangeListener(IChangeListener listener)
Removes the given change listener from the list of change listeners. |
void |
removeStaleListener(IStaleListener listener)
Removes the given stale listener from the list of stale listeners. |
getRealm
public Realm getRealm()
- Returns the realm for this observable. Unless otherwise specified,
getters and setters must be accessed from within this realm. Listeners
will be within this realm when they receive events from this observable.
Because observables can only be accessed from within one realm, and they
always fire events on that realm, their state can be observed in an
incremental way. It is always safe to call getters of an observable from
within a change listener attached to that observable.
- Returns:
- the realm
addChangeListener
public void addChangeListener(IChangeListener listener)
- Adds the given change listener to the list of change listeners. Change
listeners are notified about changes of the state of this observable in a
generic way, without specifying the change that happened. To get the
changed state, a change listener needs to query for the current state of
this observable.
- Parameters:
listener
-
removeChangeListener
public void removeChangeListener(IChangeListener listener)
- Removes the given change listener from the list of change listeners. Has
no effect if the given listener is not registered as a change listener.
- Parameters:
listener
-
addStaleListener
public void addStaleListener(IStaleListener listener)
- Adds the given stale listener to the list of stale listeners. Stale
listeners are notified when an observable object becomes stale, not when
is becomes non-stale.
- Parameters:
listener
- - See Also:
isStale()
removeStaleListener
public void removeStaleListener(IStaleListener listener)
- Removes the given stale listener from the list of stale listeners. Has no
effect if the given listener is not registered as a stale listener.
- Parameters:
listener
-
isStale
public boolean isStale()
- 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.
- Returns:
- true if this observable's state is stale and will change soon.
- "TrackedGetter"
- - implementers must call
ObservableTracker.getterCalled(IObservable)
.
dispose
public 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.
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.