Interface IObservable
- All Known Subinterfaces:
IDecoratingObservable
,IObservableCollection<E>
,IObservableList<E>
,IObservableMap<K,
,V> IObservableSet<E>
,IObservableValue<T>
,ISWTObservable
,ISWTObservableList<E>
,ISWTObservableValue<T>
,IVetoableValue<T>
,IViewerObservable
,IViewerObservableList<E>
,IViewerObservableSet<E>
,IViewerObservableValue<T>
- All Known Implementing Classes:
AbstractObservable
,AbstractObservableList
,AbstractObservableMap
,AbstractObservableSet
,AbstractObservableValue
,AbstractVetoableValue
,AggregateValidationStatus
,BidiObservableMap
,BidirectionalMap
,CompositeMap
,ComputedList
,ComputedObservableMap
,ComputedSet
,ComputedValue
,DateAndTimeObservableValue
,DecoratingObservable
,DecoratingObservableCollection
,DecoratingObservableList
,DecoratingObservableMap
,DecoratingObservableSet
,DecoratingObservableValue
,DecoratingVetoableValue
,DuplexingObservableValue
,ListToSetAdapter
,LocalDateTimeObservableValue
,MappedSet
,MultiList
,ObservableList
,ObservableMap
,ObservableSet
,SelectObservableValue
,UnionSet
,WritableList
,WritableMap
,WritableSet
,WritableValue
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 that
implement this interface.
Authors of extensions to the databinding framework may extend this interface and indirectly implement it, but if doing so must also extend one of the framework classes. (Use an API problem filter to suppress the resulting warning.)
Direct implementers of this interface outside of the framework will be broken in future releases when methods are added to this interface.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(IChangeListener listener) Adds the given change listener to the list of change listeners.void
addDisposeListener
(IDisposeListener listener) Adds the given dispose listener to the list of dispose 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.getRealm()
Returns the realm for this observable.boolean
Returns whether the observable has been disposedboolean
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
removeDisposeListener
(IDisposeListener listener) Removes the given dispose listener from the list of dispose listeners.void
removeStaleListener
(IStaleListener listener) Removes the given stale listener from the list of stale listeners.
-
Method Details
-
getRealm
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
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
- the listener to add; notnull
-
removeChangeListener
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
- the listener to remove; notnull
-
addStaleListener
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
- the listener to add; notnull
- See Also:
-
removeStaleListener
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
- the listener to remove; notnull
-
isStale
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)
.
-
addDisposeListener
Adds the given dispose listener to the list of dispose listeners. Dispose listeners are notified when an observable has been disposed.- Parameters:
listener
- the listener to add- Since:
- 1.2
-
removeDisposeListener
Removes the given dispose listener from the list of dispose listeners. Has no effect if the given listener is not registered as a dispose listener.- Parameters:
listener
- the listener to remove- Since:
- 1.2
-
isDisposed
boolean isDisposed()Returns whether the observable has been disposed- Returns:
- whether the observable has been disposed
- Since:
- 1.2
-
dispose
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.
-