public class EventStreams
extends java.lang.Object
| Constructor and Description |
|---|
EventStreams() |
| Modifier and Type | Method and Description |
|---|---|
static EventStream<java.lang.Long> |
animationFrames()
Returns a stream that, on each animation frame, emits the duration
elapsed since the previous animation frame, in nanoseconds.
|
static EventStream<java.lang.Long> |
animationTicks()
Returns an event stream that emits a timestamp of the current frame in
nanoseconds on every frame.
|
static <T> EventStream<javafx.collections.ListChangeListener.Change<? extends T>> |
changesOf(javafx.collections.ObservableList<T> list) |
static <K,V> EventStream<javafx.collections.MapChangeListener.Change<? extends K,? extends V>> |
changesOf(javafx.collections.ObservableMap<K,V> map) |
static <T> EventStream<javafx.collections.SetChangeListener.Change<? extends T>> |
changesOf(javafx.collections.ObservableSet<T> set) |
static <T> EventStream<Change<T>> |
changesOf(javafx.beans.value.ObservableValue<T> observable) |
static <A,B> EventStream<Tuple2<A,B>> |
combine(EventStream<A> srcA,
EventStream<B> srcB) |
static <A,B,C> EventStream<Tuple3<A,B,C>> |
combine(EventStream<A> srcA,
EventStream<B> srcB,
EventStream<C> srcC) |
static <A,B,C,D> EventStream<Tuple4<A,B,C,D>> |
combine(EventStream<A> srcA,
EventStream<B> srcB,
EventStream<C> srcC,
EventStream<D> srcD) |
static <A,B,C,D,E> |
combine(EventStream<A> srcA,
EventStream<B> srcB,
EventStream<C> srcC,
EventStream<D> srcD,
EventStream<E> srcE) |
static <A,B,C,D,E,F> |
combine(EventStream<A> srcA,
EventStream<B> srcB,
EventStream<C> srcC,
EventStream<D> srcD,
EventStream<E> srcE,
EventStream<F> srcF) |
static <T extends javafx.event.Event> |
eventsOf(javafx.scene.control.MenuItem menuItem,
javafx.event.EventType<T> eventType) |
static <T extends javafx.event.Event> |
eventsOf(javafx.scene.Node node,
javafx.event.EventType<T> eventType) |
static <T extends javafx.event.Event> |
eventsOf(javafx.scene.Scene scene,
javafx.event.EventType<T> eventType) |
static <T extends javafx.event.Event> |
eventsOf(javafx.stage.Window window,
javafx.event.EventType<T> eventType) |
static <L,R> Tuple2<EventStream<L>,EventStream<R>> |
fork(EventStream<? extends Either<L,R>> stream) |
static EventStream<java.lang.Void> |
invalidationsOf(javafx.beans.Observable observable)
Creates an event stream that emits an impulse on every invalidation
of the given observable.
|
static <T> EventStream<T> |
merge(EventStream<? extends T>... inputs)
Returns an event stream that emits all the events emitted from any of
the
inputs. |
static <T> EventStream<T> |
merge(javafx.collections.ObservableSet<? extends EventStream<T>> set)
Returns an event stream that emits all the events emitted from any of
the event streams in the given observable set.
|
static <T,U> EventStream<U> |
merge(javafx.collections.ObservableSet<? extends T> set,
java.util.function.Function<? super T,? extends EventStream<U>> f)
A more general version of
merge(ObservableSet) for a set of
arbitrary element type and a function to obtain an event stream from
the element. |
static <T> EventStream<T> |
never()
Returns an event stream that never emits any value.
|
static <T> EventStream<T> |
nonNullValuesOf(javafx.beans.value.ObservableValue<T> observable) |
static <O extends javafx.beans.Observable> |
repeatOnInvalidation(O observable)
Creates an event stream that emits the given observable immediately for
every subscriber and re-emits it on every subsequent invalidation of the
observable.
|
static EventStream<?> |
restartableTicks(java.time.Duration interval,
EventStream<?> impulse)
Returns a
ticks(Duration) EventStream whose timer restarts whenever
impulse emits an event. |
static EventStream<?> |
restartableTicks0(java.time.Duration interval,
EventStream<?> impulse)
Returns a
ticks0(Duration) EventStream whose timer restarts whenever
impulse emits an event. |
static <T> EventStream<ListModification<? extends T>> |
simpleChangesOf(javafx.collections.ObservableList<T> list)
Use only when the subscriber does not cause
list modification
of the underlying list. |
static <C extends java.util.Collection<?> & javafx.beans.Observable> |
sizeOf(C collection) |
static EventStream<java.lang.Integer> |
sizeOf(javafx.collections.ObservableMap<?,?> map) |
static EventStream<?> |
ticks(java.time.Duration interval)
Returns an event stream that emits periodic ticks.
|
static EventStream<?> |
ticks(java.time.Duration interval,
java.util.concurrent.ScheduledExecutorService scheduler,
java.util.concurrent.Executor eventThreadExecutor)
Returns an event stream that emits periodic ticks on the given
eventThreadExecutor. |
static EventStream<?> |
ticks0(java.time.Duration interval)
Returns an event stream that emits periodic ticks.
|
static <T> EventStream<T> |
valuesOf(javafx.beans.value.ObservableValue<T> observable)
Creates an event stream that emits the value of the given
ObservableValue immediately for every subscriber and then on
every change. |
static <A,B> EventStream<Tuple2<A,B>> |
zip(EventStream<A> srcA,
EventStream<B> srcB) |
static <A,B,C> EventStream<Tuple3<A,B,C>> |
zip(EventStream<A> srcA,
EventStream<B> srcB,
EventStream<C> srcC) |
public static <T> EventStream<T> never()
public static EventStream<java.lang.Void> invalidationsOf(javafx.beans.Observable observable)
public static <O extends javafx.beans.Observable> EventStream<O> repeatOnInvalidation(O observable)
public static <T> EventStream<T> valuesOf(javafx.beans.value.ObservableValue<T> observable)
ObservableValue immediately for every subscriber and then on
every change.public static <T> EventStream<T> nonNullValuesOf(javafx.beans.value.ObservableValue<T> observable)
public static <T> EventStream<Change<T>> changesOf(javafx.beans.value.ObservableValue<T> observable)
public static <T> EventStream<javafx.collections.ListChangeListener.Change<? extends T>> changesOf(javafx.collections.ObservableList<T> list)
LiveList.changesOf(ObservableList)public static <T> EventStream<ListModification<? extends T>> simpleChangesOf(javafx.collections.ObservableList<T> list)
list modification
of the underlying list.public static <T> EventStream<javafx.collections.SetChangeListener.Change<? extends T>> changesOf(javafx.collections.ObservableSet<T> set)
public static <K,V> EventStream<javafx.collections.MapChangeListener.Change<? extends K,? extends V>> changesOf(javafx.collections.ObservableMap<K,V> map)
public static <C extends java.util.Collection<?> & javafx.beans.Observable> EventStream<java.lang.Integer> sizeOf(C collection)
public static EventStream<java.lang.Integer> sizeOf(javafx.collections.ObservableMap<?,?> map)
public static <T extends javafx.event.Event> EventStream<T> eventsOf(javafx.scene.Node node, javafx.event.EventType<T> eventType)
public static <T extends javafx.event.Event> EventStream<T> eventsOf(javafx.scene.Scene scene, javafx.event.EventType<T> eventType)
public static <T extends javafx.event.Event> EventStream<T> eventsOf(javafx.scene.control.MenuItem menuItem, javafx.event.EventType<T> eventType)
public static <T extends javafx.event.Event> EventStream<T> eventsOf(javafx.stage.Window window, javafx.event.EventType<T> eventType)
public static EventStream<?> ticks(java.time.Duration interval)
interval amount of time has passed.
The returned stream may only be used on the JavaFX application thread.
As with all lazily bound streams, ticks are emitted only when there is at least one subscriber to the returned stream. This means that to release associated resources, it suffices to unsubscribe from the returned stream.
public static EventStream<?> ticks0(java.time.Duration interval)
As with all lazily bound streams, ticks are emitted only when there is at least one subscriber to the returned stream. This means that to release associated resources, it suffices to unsubscribe from the returned stream.
public static EventStream<?> ticks(java.time.Duration interval, java.util.concurrent.ScheduledExecutorService scheduler, java.util.concurrent.Executor eventThreadExecutor)
eventThreadExecutor. The returned stream may only be used from
that executor's thread.
As with all lazily bound streams, ticks are emitted only when there is at least one subscriber to the returned stream. This means that to release associated resources, it suffices to unsubscribe from the returned stream.
scheduler - scheduler used to schedule periodic emissions.eventThreadExecutor - single-thread executor used to emit the ticks.public static EventStream<?> restartableTicks(java.time.Duration interval, EventStream<?> impulse)
ticks(Duration) EventStream whose timer restarts whenever
impulse emits an event.interval - - the amount of time that passes until this stream emits its next tickimpulse - - the EventStream that resets this EventStream's internal timerpublic static EventStream<?> restartableTicks0(java.time.Duration interval, EventStream<?> impulse)
ticks0(Duration) EventStream whose timer restarts whenever
impulse emits an event. Note: since ticks0(Duration) is used, restarting
the timer will make the returned EventStream immediately emit a new tick.interval - - the amount of time that passes until this stream emits its next tickimpulse - - the EventStream that resets this EventStream's internal timerpublic static EventStream<java.lang.Long> animationTicks()
AnimationTimer.handle(long) method.public static EventStream<java.lang.Long> animationFrames()
@SafeVarargs public static <T> EventStream<T> merge(EventStream<? extends T>... inputs)
inputs. The event type of the returned stream is the nearest
common super-type of all the inputs.EventStream.or(EventStream)public static <T> EventStream<T> merge(javafx.collections.ObservableSet<? extends EventStream<T>> set)
public static <T,U> EventStream<U> merge(javafx.collections.ObservableSet<? extends T> set, java.util.function.Function<? super T,? extends EventStream<U>> f)
merge(ObservableSet) for a set of
arbitrary element type and a function to obtain an event stream from
the element.set - observable set of elementsf - function to obtain an event stream from an elementpublic static <L,R> Tuple2<EventStream<L>,EventStream<R>> fork(EventStream<? extends Either<L,R>> stream)
public static <A,B> EventStream<Tuple2<A,B>> zip(EventStream<A> srcA, EventStream<B> srcB)
public static <A,B,C> EventStream<Tuple3<A,B,C>> zip(EventStream<A> srcA, EventStream<B> srcB, EventStream<C> srcC)
public static <A,B> EventStream<Tuple2<A,B>> combine(EventStream<A> srcA, EventStream<B> srcB)
public static <A,B,C> EventStream<Tuple3<A,B,C>> combine(EventStream<A> srcA, EventStream<B> srcB, EventStream<C> srcC)
public static <A,B,C,D> EventStream<Tuple4<A,B,C,D>> combine(EventStream<A> srcA, EventStream<B> srcB, EventStream<C> srcC, EventStream<D> srcD)
public static <A,B,C,D,E> EventStream<Tuple5<A,B,C,D,E>> combine(EventStream<A> srcA, EventStream<B> srcB, EventStream<C> srcC, EventStream<D> srcD, EventStream<E> srcE)
public static <A,B,C,D,E,F> EventStream<Tuple6<A,B,C,D,E,F>> combine(EventStream<A> srcA, EventStream<B> srcB, EventStream<C> srcC, EventStream<D> srcD, EventStream<E> srcE, EventStream<F> srcF)