public class Observables extends Object
Observables
.Constructor and Description |
---|
Observables() |
Modifier and Type | Method and Description |
---|---|
static <T> IObservableValue<T> |
constantObservableValue(Realm realm,
T value)
Returns an observable value with the given constant value.
|
static <T> IObservableValue<T> |
constantObservableValue(Realm realm,
T value,
Object valueType)
Returns an observable value with the given constant value.
|
static <T> IObservableValue<T> |
constantObservableValue(T value)
Returns an observable value with the given constant value.
|
static <T> IObservableValue<T> |
constantObservableValue(T value,
T valueType)
Returns an observable value with the given constant value.
|
static <E> IObservableList<E> |
emptyObservableList()
Returns an empty observable list.
|
static <E> IObservableList<E> |
emptyObservableList(Object elementType)
Returns an empty observable list of the given element type.
|
static <E> IObservableList<E> |
emptyObservableList(Realm realm)
Returns an empty observable list belonging to the given realm.
|
static <E> IObservableList<E> |
emptyObservableList(Realm realm,
Object elementType)
Returns an empty observable list of the given element type and belonging
to the given realm.
|
static <E> IObservableSet<E> |
emptyObservableSet()
Returns an empty observable set.
|
static <E> IObservableSet<E> |
emptyObservableSet(Object elementType)
Returns an empty observable set of the given element type.
|
static <E> IObservableSet<E> |
emptyObservableSet(Realm realm)
Returns an empty observable set belonging to the given realm.
|
static <E> IObservableSet<E> |
emptyObservableSet(Realm realm,
Object elementType)
Returns an empty observable set of the given element type and belonging
to the given realm.
|
static <K,V> IObservableFactory<K,IObservableValue<V>> |
mapEntryValueFactory(IObservableMap<K,V> map,
Object valueType)
Returns a factory for creating observable values tracking the value of
the
observable map entry identified by a
particular key. |
static <T> IObservableValue<T> |
observeDelayedValue(int delay,
IObservableValue<T> observable)
Returns an observable which delays notification of value change events
from
observable until delay milliseconds have
elapsed since the last change event. |
static <K,V> IObservableValue<V> |
observeDetailMapEntry(IObservableMap<K,V> map,
IObservableValue<K> master,
Object valueType)
Helper method for
MasterDetailObservables.detailValue(master,
mapEntryValueFactory(map, valueType), valueType) . |
static <K,V> IObservableValue<V> |
observeMapEntry(IObservableMap<K,V> map,
K key)
Returns an observable value that tracks changes to the value of an
observable map's entry specified by its key.
|
static <K,V> IObservableValue<V> |
observeMapEntry(IObservableMap<K,V> map,
K key,
Object valueType)
Returns an observable value that tracks changes to the value of an
observable map's entry specified by its key.
|
static IObservableValue<Boolean> |
observeStale(IObservable observable)
Returns an observable value of type
Boolean.TYPE which
tracks whether the given observable is stale. |
static <T> void |
pipe(IObservableValue<T> source,
IObservableValue<? super T> destination)
Copies the current value of the source observable to the destination
observable, and upon value change events fired by the source observable,
updates the destination observable accordingly, until the source
observable is disposed.
|
static <E> IObservableList<E> |
proxyObservableList(IObservableList<E> target)
Returns an observable list that contains the same elements as the given
list, and fires the same events as the given list, but can be disposed of
without disposing of the wrapped list.
|
static <K,V> IObservableMap<K,V> |
proxyObservableMap(IObservableMap<K,V> target)
Returns an observable map that contains the same entries as the given
map, and fires the same events as the given map, but can be disposed of
without disposing of the wrapped map.
|
static <E> IObservableSet<E> |
proxyObservableSet(IObservableSet<E> target)
Returns an observable set that contains the same elements as the given
set, and fires the same events as the given set, but can be disposed of
without disposing of the wrapped set.
|
static <T> IObservableValue<T> |
proxyObservableValue(IObservableValue<T> target)
Returns an observable value that contains the same value as the given
observable, and fires the same events as the given observable, but can be
disposed of without disposing of the wrapped observable.
|
static <E> IObservableList<E> |
staticObservableList(List<E> list)
Returns an observable list backed by the given list.
|
static <E> IObservableList<E> |
staticObservableList(List<E> list,
Object elementType)
Returns an observable list of the given element type, backed by the given
list.
|
static <E> IObservableList<E> |
staticObservableList(Realm realm,
List<E> list)
Returns an observable list belonging to the given realm, backed by the
given list.
|
static <E> IObservableList<E> |
staticObservableList(Realm realm,
List<E> list,
Object elementType)
Returns an observable list of the given element type and belonging to the
given realm, backed by the given list.
|
static <E> IObservableSet<E> |
staticObservableSet(Realm realm,
Set<E> set)
Returns an observable set belonging to the given realm, backed by the
given set.
|
static <E> IObservableSet<E> |
staticObservableSet(Realm realm,
Set<E> set,
Object elementType)
Returns an observable set of the given element type and belonging to the
given realm, backed by the given set.
|
static <E> IObservableSet<E> |
staticObservableSet(Set<E> set)
Returns an observable set backed by the given set.
|
static <E> IObservableSet<E> |
staticObservableSet(Set<E> set,
Object elementType)
Returns an observable set of the given element type, backed by the given
set.
|
static <E> IObservableList<E> |
unmodifiableObservableList(IObservableList<E> list)
Returns an unmodifiable observable list backed by the given observable
list.
|
static <K,V> IObservableMap<K,V> |
unmodifiableObservableMap(IObservableMap<K,V> map)
Returns an unmodifiable observable map backed by the given observable
map.
|
static <E> IObservableSet<E> |
unmodifiableObservableSet(IObservableSet<E> set)
Returns an unmodifiable observable set backed by the given observable
set.
|
static <T> IObservableValue<T> |
unmodifiableObservableValue(IObservableValue<T> value)
Returns an unmodifiable observable value backed by the given observable
value.
|
public static <T> IObservableValue<T> observeDelayedValue(int delay, IObservableValue<T> observable)
observable
until delay
milliseconds have
elapsed since the last change event. This observable helps to boost
performance in situations where an observable has computationally
expensive listeners or many dependencies. A common use of this observable
is to delay validation of user input until the user stops typing in a UI
field.
To notify about pending changes, the returned observable fires a stale
event when the wrapped observable value fires a change event, and remains
stale until the delay has elapsed and the value change is fired. A call
to getValue()
while a value change is
pending will fire the value change immediately, short-circuiting the
delay.
Note:
ValueChangingEvent
events
from a wrapped IVetoableValue
.
T
- the value typedelay
- the delay in millisecondsobservable
- the observable being delayedobservable
until delay
milliseconds have elapsed since the last change event.public static <T> IObservableValue<T> unmodifiableObservableValue(IObservableValue<T> value)
T
- the value typevalue
- the value to wrap in an unmodifiable valuepublic static <T> IObservableValue<T> constantObservableValue(Realm realm, T value, Object valueType)
T
- the value typerealm
- the observable's realmvalue
- the observable's constant valuevalueType
- the observable's value typepublic static <T> IObservableValue<T> constantObservableValue(Realm realm, T value)
T
- realm
- the observable's realmvalue
- the observable's constant valuepublic static <T> IObservableValue<T> constantObservableValue(T value, T valueType)
T
- the value typevalue
- the observable's constant valuevalueType
- the observable's value typepublic static <T> IObservableValue<T> constantObservableValue(T value)
T
- value
- the observable's constant valuepublic static <E> IObservableList<E> unmodifiableObservableList(IObservableList<E> list)
E
- the element typelist
- the list to wrap in an unmodifiable listpublic static <E> IObservableSet<E> unmodifiableObservableSet(IObservableSet<E> set)
E
- set
- the set to wrap in an unmodifiable setpublic static <K,V> IObservableMap<K,V> unmodifiableObservableMap(IObservableMap<K,V> map)
K
- map key typeV
- map value typemap
- the map to wrap in an unmodifiable mappublic static <E> IObservableList<E> emptyObservableList()
E
- the list element typepublic static <E> IObservableList<E> emptyObservableList(Object elementType)
E
- the list element typeelementType
- the element type of the returned listpublic static <E> IObservableList<E> emptyObservableList(Realm realm)
E
- the list element typerealm
- the realm of the returned listpublic static <E> IObservableList<E> emptyObservableList(Realm realm, Object elementType)
E
- the list element typerealm
- the realm of the returned listelementType
- the element type of the returned listpublic static <E> IObservableSet<E> emptyObservableSet()
E
- the set element typepublic static <E> IObservableSet<E> emptyObservableSet(Object elementType)
E
- the set element typeelementType
- the element type of the returned setpublic static <E> IObservableSet<E> emptyObservableSet(Realm realm)
E
- the set element typerealm
- the realm of the returned setpublic static <E> IObservableSet<E> emptyObservableSet(Realm realm, Object elementType)
E
- the set element typerealm
- the realm of the returned setelementType
- the element type of the returned setpublic static <E> IObservableSet<E> staticObservableSet(Set<E> set)
E
- the set element typeset
- the set to wrap in an IObservableSetpublic static <E> IObservableSet<E> staticObservableSet(Set<E> set, Object elementType)
E
- the set element typeset
- the set to wrap in an IObservableSetelementType
- the element type of the returned setpublic static <E> IObservableSet<E> staticObservableSet(Realm realm, Set<E> set)
E
- realm
- the realm of the returned setset
- the set to wrap in an IObservableSetpublic static <E> IObservableSet<E> staticObservableSet(Realm realm, Set<E> set, Object elementType)
E
- the set element typerealm
- the realm of the returned setset
- the set to wrap in an IObservableSetelementType
- the element type of the returned setpublic static <T> IObservableValue<T> proxyObservableValue(IObservableValue<T> target)
T
- the value typetarget
- the observable value to wrappublic static <E> IObservableSet<E> proxyObservableSet(IObservableSet<E> target)
E
- the set element typetarget
- the set to wrappublic static <E> IObservableList<E> proxyObservableList(IObservableList<E> target)
E
- the list element typetarget
- the list to wrappublic static <K,V> IObservableMap<K,V> proxyObservableMap(IObservableMap<K,V> target)
K
- the map key typeV
- the map value typetarget
- the map to wrappublic static <E> IObservableList<E> staticObservableList(List<E> list)
E
- the list element typelist
- the list to wrap in an IObservableListpublic static <E> IObservableList<E> staticObservableList(List<E> list, Object elementType)
E
- the list element typelist
- the list to wrap in an IObservableListelementType
- the element type of the returned listpublic static <E> IObservableList<E> staticObservableList(Realm realm, List<E> list)
E
- the list element typerealm
- the realm of the returned listlist
- the list to wrap in an IObservableListpublic static <E> IObservableList<E> staticObservableList(Realm realm, List<E> list, Object elementType)
E
- the list element typerealm
- the realm of the returned listlist
- the list to wrap in an IObservableListelementType
- the element type of the returned listpublic static IObservableValue<Boolean> observeStale(IObservable observable)
Boolean.TYPE
which
tracks whether the given observable is stale.observable
- the observable to trackpublic static <K,V> IObservableValue<V> observeMapEntry(IObservableMap<K,V> map, K key)
The state where the key does not exist in the map is equivalent to the
state where the key exists and its value is null
. The
transition between these two states is not considered a value change and
no event is fired.
K
- the map key typeV
- the map value typemap
- the observable map whose entry will be tracked.key
- the key identifying the map entry to track.public static <K,V> IObservableValue<V> observeMapEntry(IObservableMap<K,V> map, K key, Object valueType)
The state where the key does not exist in the map is equivalent to the
state where the key exists and its value is null
. The
transition between these two states is not considered a value change and
no event is fired.
K
- the map key typeV
- the map value typemap
- the observable map whose entry will be tracked.key
- the key identifying the map entry to track.valueType
- the type of the value. May be null
, meaning the
value is untyped.public static <K,V> IObservableFactory<K,IObservableValue<V>> mapEntryValueFactory(IObservableMap<K,V> map, Object valueType)
observable map
entry identified by a
particular key.K
- the map key typeV
- the map value typemap
- the observable map whose entry will be tracked.valueType
- the type of the value. May be null
, meaning the
value is untyped.public static <K,V> IObservableValue<V> observeDetailMapEntry(IObservableMap<K,V> map, IObservableValue<K> master, Object valueType)
MasterDetailObservables.detailValue(master,
mapEntryValueFactory(map, valueType), valueType)
.K
- the map key typeV
- the map value typemap
- the observable map whose entry will be tracked.master
- the observable value that identifies which map entry to track.valueType
- the type of the value. May be null
, meaning the
value is untyped.public static <T> void pipe(IObservableValue<T> source, IObservableValue<? super T> destination)
T
- the value typesource
- the source observabledestination
- the destination observable
Copyright (c) 2000, 2016 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.