Class ReactfxUtil
- java.lang.Object
-
- net.sourceforge.pmd.util.fxdesigner.util.reactfx.ReactfxUtil
-
public final class ReactfxUtil extends java.lang.ObjectExtensions to ReactFX Val and EventStreams. Some can be deemed as too general for this project: I'd like them to be moved to the reactfx main project -> but it's unmaintained.- Author:
- Clément Fournier
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends javafx.event.Event>
org.reactfx.SubscriptionaddEventHandler(javafx.beans.property.Property<javafx.event.EventHandler<T>> addMethod, javafx.event.EventHandler<T> handler)static <T extends javafx.event.Event>
org.reactfx.SubscriptionaddEventHandler(javafx.scene.Node node, javafx.event.EventType<T> type, javafx.event.EventHandler<T> handler)static org.reactfx.value.Var<java.lang.Boolean>booleanVar(javafx.beans.property.BooleanProperty p)static <T> org.reactfx.value.Var<T>defaultedVar(org.reactfx.value.Val<? extends T> defaultValue)static <I> org.reactfx.EventStream<I>distinctBetween(org.reactfx.EventStream<I> input, java.time.Duration duration)static <T> com.github.oowekyala.rxstring.ReactfxExtensions.RebindSubscription<T>emptySub()static <E> org.reactfx.collection.LiveList<E>flattenList(org.reactfx.value.Val<? extends javafx.collections.ObservableList<E>> base)static <K,V>
org.reactfx.value.Val<java.util.Map<K,org.reactfx.collection.LiveList<V>>>groupBy(javafx.collections.ObservableList<? extends V> base, java.util.function.Function<? super V,? extends K> selector)static org.reactfx.value.Val<java.lang.Boolean>isPresentProperty(org.reactfx.value.Val<?> v)static <T> org.reactfx.value.Val<T>latestValue(org.reactfx.EventStream<T> values)Converts an event stream to a val, that always holds the latest emitted value of the stream.static <I,O>
com.github.oowekyala.rxstring.ReactfxExtensions.RebindSubscription<O>map(com.github.oowekyala.rxstring.ReactfxExtensions.RebindSubscription<I> base, java.util.function.Function<O,I> f)static <T,S>
org.reactfx.collection.LiveList<S>mapBothWays(javafx.collections.ObservableList<T> base, java.util.function.Function<T,S> forward, java.util.function.Function<S,T> backward)static <E> org.reactfx.EventStream<?>modificationTicks(javafx.collections.ObservableList<? extends E> list, java.util.function.Function<? super E,? extends org.reactfx.EventStream<?>> tickProvider)static <K,V>
org.reactfx.value.Val<java.util.Map<K,V>>observableMapVal(javafx.collections.ObservableMap<K,V> map)static <T> org.reactfx.EventStream<T>reduceEntangledIfPossible(org.reactfx.EventStream<T> input, java.util.function.BiPredicate<T,T> canReduce, java.util.function.BinaryOperator<T> reduction, java.time.Duration duration)Like reduce if possible, but can be used if the events to reduce are emitted in extremely close succession, so close that some unrelated events may be mixed up.static <T> org.reactfx.Subscriptionrewire(javafx.beans.property.Property<T> underlying, javafx.beans.value.ObservableValue<? extends T> source)Like rewireInit, with no initialisation.static <T> org.reactfx.SubscriptionrewireInit(javafx.beans.property.Property<T> underlying, javafx.beans.property.Property<T> ui)Like the other overload, using the setter of the ui property.static <T> org.reactfx.SubscriptionrewireInit(javafx.beans.property.Property<T> underlying, javafx.beans.value.ObservableValue<? extends T> ui, java.util.function.Consumer<? super T> setter)Binds the underlying property to a source of values (UI property).static <T> org.reactfx.SubscriptionsubscribeDisposable(javafx.beans.value.ObservableValue<? extends T> node, java.util.function.Function<? super T,org.reactfx.Subscription> subscriber)Add a hook on the owner window.static <T> org.reactfx.SubscriptionsubscribeDisposable(org.reactfx.EventStream<T> stream, java.util.function.Function<T,org.reactfx.Subscription> subscriber)static <T> org.reactfx.value.Val<T>vetoableNull(org.reactfx.value.Val<T> base, java.time.Duration duration)static org.reactfx.value.Val<java.lang.Boolean>vetoableYes(org.reactfx.value.Val<java.lang.Boolean> base, java.time.Duration vetoPeriod)Returns a val that reflects "true" values of the input val only after the [vetoPeriod], and only if they're not vetoed by a "false" value emitted during the veto period.static <T> org.reactfx.value.Val<T>withInvalidations(org.reactfx.value.Val<T> base, java.util.function.Function<T,org.reactfx.EventStream<?>> otherInvalidations)
-
-
-
Method Detail
-
emptySub
public static <T> com.github.oowekyala.rxstring.ReactfxExtensions.RebindSubscription<T> emptySub()
-
map
public static <I,O> com.github.oowekyala.rxstring.ReactfxExtensions.RebindSubscription<O> map(com.github.oowekyala.rxstring.ReactfxExtensions.RebindSubscription<I> base, java.util.function.Function<O,I> f)
-
isPresentProperty
public static org.reactfx.value.Val<java.lang.Boolean> isPresentProperty(org.reactfx.value.Val<?> v)
-
subscribeDisposable
public static <T> org.reactfx.Subscription subscribeDisposable(javafx.beans.value.ObservableValue<? extends T> node, java.util.function.Function<? super T,org.reactfx.Subscription> subscriber)Add a hook on the owner window. It's not possible to do this statically, since at construction time the window might not be set.
-
modificationTicks
public static <E> org.reactfx.EventStream<?> modificationTicks(javafx.collections.ObservableList<? extends E> list, java.util.function.Function<? super E,? extends org.reactfx.EventStream<?>> tickProvider)
-
subscribeDisposable
public static <T> org.reactfx.Subscription subscribeDisposable(org.reactfx.EventStream<T> stream, java.util.function.Function<T,org.reactfx.Subscription> subscriber)
-
defaultedVar
public static <T> org.reactfx.value.Var<T> defaultedVar(org.reactfx.value.Val<? extends T> defaultValue)
-
mapBothWays
public static <T,S> org.reactfx.collection.LiveList<S> mapBothWays(javafx.collections.ObservableList<T> base, java.util.function.Function<T,S> forward, java.util.function.Function<S,T> backward)
-
addEventHandler
public static <T extends javafx.event.Event> org.reactfx.Subscription addEventHandler(javafx.beans.property.Property<javafx.event.EventHandler<T>> addMethod, javafx.event.EventHandler<T> handler)
-
addEventHandler
public static <T extends javafx.event.Event> org.reactfx.Subscription addEventHandler(javafx.scene.Node node, javafx.event.EventType<T> type, javafx.event.EventHandler<T> handler)
-
distinctBetween
public static <I> org.reactfx.EventStream<I> distinctBetween(org.reactfx.EventStream<I> input, java.time.Duration duration)
-
groupBy
public static <K,V> org.reactfx.value.Val<java.util.Map<K,org.reactfx.collection.LiveList<V>>> groupBy(javafx.collections.ObservableList<? extends V> base, java.util.function.Function<? super V,? extends K> selector)
-
flattenList
public static <E> org.reactfx.collection.LiveList<E> flattenList(org.reactfx.value.Val<? extends javafx.collections.ObservableList<E>> base)
-
observableMapVal
public static <K,V> org.reactfx.value.Val<java.util.Map<K,V>> observableMapVal(javafx.collections.ObservableMap<K,V> map)
-
withInvalidations
public static <T> org.reactfx.value.Val<T> withInvalidations(org.reactfx.value.Val<T> base, java.util.function.Function<T,org.reactfx.EventStream<?>> otherInvalidations)
-
latestValue
public static <T> org.reactfx.value.Val<T> latestValue(org.reactfx.EventStream<T> values)
Converts an event stream to a val, that always holds the latest emitted value of the stream.
-
vetoableYes
public static org.reactfx.value.Val<java.lang.Boolean> vetoableYes(org.reactfx.value.Val<java.lang.Boolean> base, java.time.Duration vetoPeriod)Returns a val that reflects "true" values of the input val only after the [vetoPeriod], and only if they're not vetoed by a "false" value emitted during the veto period. "false" values are reflected immediately.
-
vetoableNull
public static <T> org.reactfx.value.Val<T> vetoableNull(org.reactfx.value.Val<T> base, java.time.Duration duration)
-
rewireInit
public static <T> org.reactfx.Subscription rewireInit(javafx.beans.property.Property<T> underlying, javafx.beans.property.Property<T> ui)Like the other overload, using the setter of the ui property.
-
rewireInit
public static <T> org.reactfx.Subscription rewireInit(javafx.beans.property.Property<T> underlying, javafx.beans.value.ObservableValue<? extends T> ui, java.util.function.Consumer<? super T> setter)Binds the underlying property to a source of values (UI property). The UI property is also initialised using a setter.- Type Parameters:
T- Type of values- Parameters:
underlying- The underlying propertyui- The property exposed to the user (the one in this wizard)setter- Setter to initialise the UI value
-
rewire
public static <T> org.reactfx.Subscription rewire(javafx.beans.property.Property<T> underlying, javafx.beans.value.ObservableValue<? extends T> source)Like rewireInit, with no initialisation.
-
booleanVar
public static org.reactfx.value.Var<java.lang.Boolean> booleanVar(javafx.beans.property.BooleanProperty p)
-
reduceEntangledIfPossible
public static <T> org.reactfx.EventStream<T> reduceEntangledIfPossible(org.reactfx.EventStream<T> input, java.util.function.BiPredicate<T,T> canReduce, java.util.function.BinaryOperator<T> reduction, java.time.Duration duration)Like reduce if possible, but can be used if the events to reduce are emitted in extremely close succession, so close that some unrelated events may be mixed up. This reduces each new event with a related event in the pending notification chain instead of just considering the last one as a possible reduction target.
-
-