Package org.reactfx

Class EventStreams

java.lang.Object
org.reactfx.EventStreams

public class EventStreams extends Object
  • Field Details

  • Constructor Details

    • EventStreams

      public EventStreams()
  • Method Details

    • never

      public static <T> EventStream<T> never()
      Returns an event stream that never emits any value.
    • invalidationsOf

      public static EventStream<Void> invalidationsOf(javafx.beans.Observable observable)
      Creates an event stream that emits an impulse on every invalidation of the given observable.
    • repeatOnInvalidation

      public static <O extends javafx.beans.Observable> EventStream<O> 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.
    • valuesOf

      public 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.
    • nonNullValuesOf

      public static <T> EventStream<T> nonNullValuesOf(javafx.beans.value.ObservableValue<T> observable)
    • changesOf

      public static <T> EventStream<Change<T>> changesOf(javafx.beans.value.ObservableValue<T> observable)
    • changesOf

      public static <T> EventStream<javafx.collections.ListChangeListener.Change<? extends T>> changesOf(javafx.collections.ObservableList<T> list)
      See Also:
    • simpleChangesOf

      public 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.
    • changesOf

      public static <T> EventStream<javafx.collections.SetChangeListener.Change<? extends T>> changesOf(javafx.collections.ObservableSet<T> set)
    • changesOf

      public static <K, V> EventStream<javafx.collections.MapChangeListener.Change<? extends K,? extends V>> changesOf(javafx.collections.ObservableMap<K,V> map)
    • sizeOf

      public static <C extends Collection<?> & javafx.beans.Observable> EventStream<Integer> sizeOf(C collection)
    • sizeOf

      public static EventStream<Integer> sizeOf(javafx.collections.ObservableMap<?,?> map)
    • create

      private static <T> EventStream<T> create(Supplier<? extends T> computeValue, javafx.beans.Observable... dependencies)
    • eventsOf

      public static <T extends javafx.event.Event> EventStream<T> eventsOf(javafx.scene.Node node, javafx.event.EventType<T> eventType)
    • eventsOf

      public static <T extends javafx.event.Event> EventStream<T> eventsOf(javafx.scene.Scene scene, javafx.event.EventType<T> eventType)
    • eventsOf

      public static <T extends javafx.event.Event> EventStream<T> eventsOf(javafx.scene.control.MenuItem menuItem, javafx.event.EventType<T> eventType)
    • eventsOf

      public static <T extends javafx.event.Event> EventStream<T> eventsOf(javafx.stage.Window window, javafx.event.EventType<T> eventType)
    • ticks

      public static EventStream<?> ticks(Duration interval)
      Returns an event stream that emits periodic ticks. The first tick is emitted after 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.

    • ticks0

      public static EventStream<?> ticks0(Duration interval)
      Returns an event stream that emits periodic ticks. The first tick is emitted at time 0. 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.

    • ticks

      public static EventStream<?> ticks(Duration interval, ScheduledExecutorService scheduler, Executor eventThreadExecutor)
      Returns an event stream that emits periodic ticks on the given 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.

      Parameters:
      scheduler - scheduler used to schedule periodic emissions.
      eventThreadExecutor - single-thread executor used to emit the ticks.
    • restartableTicks

      public static EventStream<?> restartableTicks(Duration interval, EventStream<?> impulse)
      Returns a ticks(Duration) EventStream whose timer restarts whenever impulse emits an event.
      Parameters:
      interval - - the amount of time that passes until this stream emits its next tick
      impulse - - the EventStream that resets this EventStream's internal timer
    • restartableTicks0

      public static EventStream<?> restartableTicks0(Duration interval, EventStream<?> impulse)
      Returns a 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.
      Parameters:
      interval - - the amount of time that passes until this stream emits its next tick
      impulse - - the EventStream that resets this EventStream's internal timer
    • animationTicks

      public static EventStream<Long> animationTicks()
      Returns an event stream that emits a timestamp of the current frame in nanoseconds on every frame. The timestamp has the same meaning as the argument of the AnimationTimer.handle(long) method.
    • animationFrames

      public static EventStream<Long> animationFrames()
      Returns a stream that, on each animation frame, emits the duration elapsed since the previous animation frame, in nanoseconds.
    • merge

      @SafeVarargs public static <T> EventStream<T> merge(EventStream<? extends T>... inputs)
      Returns an event stream that emits all the events emitted from any of the inputs. The event type of the returned stream is the nearest common super-type of all the inputs.
      See Also:
    • merge

      public 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. When an event stream is added to the set, the returned stream will start emitting its events. When an event stream is removed from the set, its events will no longer be emitted from the returned stream.
    • merge

      public static <T, U> EventStream<U> merge(javafx.collections.ObservableSet<? extends T> set, 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.
      Parameters:
      set - observable set of elements
      f - function to obtain an event stream from an element
    • fork

      public static <L, R> Tuple2<EventStream<L>,EventStream<R>> fork(EventStream<? extends Either<L,R>> stream)
    • zip

      public static <A, B> EventStream<Tuple2<A,B>> zip(EventStream<A> srcA, EventStream<B> srcB)
    • zip

      public static <A, B, C> EventStream<Tuple3<A,B,C>> zip(EventStream<A> srcA, EventStream<B> srcB, EventStream<C> srcC)
    • combine

      public static <A, B> EventStream<Tuple2<A,B>> combine(EventStream<A> srcA, EventStream<B> srcB)
    • combine

      public static <A, B, C> EventStream<Tuple3<A,B,C>> combine(EventStream<A> srcA, EventStream<B> srcB, EventStream<C> srcC)
    • combine

      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)
    • combine

      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)
    • combine

      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)