Package org.reactfx
Class SuspendableBoolean
- java.lang.Object
-
- org.reactfx.ObservableBase<java.util.function.Consumer<? super T>,T>
-
- org.reactfx.value.ValBase<java.lang.Boolean>
-
- org.reactfx.SuspendableBoolean
-
- All Implemented Interfaces:
javafx.beans.Observable
,javafx.beans.value.ObservableBooleanValue
,javafx.beans.value.ObservableValue<java.lang.Boolean>
,Observable<java.util.function.Consumer<? super java.lang.Boolean>>
,ProperObservable<java.util.function.Consumer<? super java.lang.Boolean>,java.lang.Boolean>
,Suspendable
,Toggle
,ProperVal<java.lang.Boolean>
,Val<java.lang.Boolean>
- Direct Known Subclasses:
SuspendableNo
,SuspendableYes
abstract class SuspendableBoolean extends ValBase<java.lang.Boolean> implements javafx.beans.value.ObservableBooleanValue, Toggle
-
-
Field Summary
Fields Modifier and Type Field Description private int
suspenders
-
Constructor Summary
Constructors Constructor Description SuspendableBoolean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Boolean
computeValue()
protected Subscription
connect()
Implementation of this method should start observing inputs.protected boolean
isSuspended()
EventStream<?>
noes()
private void
release()
Guard
suspend()
Suspends this suspendable object.EventStream<?>
yeses()
-
Methods inherited from class org.reactfx.value.ValBase
getValue, invalidate, newObserver, observeInputs
-
Methods inherited from class org.reactfx.ObservableBase
addObserver, enqueueNotifications, equals, forEachObserver, getObserverCount, hashCode, isObservingInputs, notifyObservers, notifyObservers, observe, removeObserver, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.reactfx.Observable
addObserver, observe, removeObserver
-
Methods inherited from interface org.reactfx.ProperObservable
defaultEquals, defaultHashCode, defaultToString, notifyObservers
-
Methods inherited from interface org.reactfx.value.ProperVal
defaultNotificationAccumulator
-
Methods inherited from interface org.reactfx.Suspendable
suspendWhen, suspendWhile, suspendWhile
-
Methods inherited from interface org.reactfx.value.Val
addInvalidationObserver, addListener, addListener, animate, animate, asList, asVar, changes, conditionOn, conditionOnShowing, filter, flatMap, getOpt, getOrElse, getOrSupply, getOrThrow, ifPresent, invalidations, isEmpty, isPresent, map, mapDynamic, observeChanges, observeInvalidations, orElse, orElseConst, pin, removeInvalidationObserver, removeListener, removeListener, selectVar, selectVar, suspendable, values
-
-
-
-
Method Detail
-
suspend
public final Guard suspend()
Description copied from interface:Suspendable
Suspends this suspendable object.In case of suspendable
Observable
, suspends notification delivery for this observable object. Notifications produced while suspended may be queued for later delivery, accumulated into a single cumulative notification, or discarded completely, depending on the concrete implementation.- Specified by:
suspend
in interfaceSuspendable
- Returns:
- a Guard instance that can be released to end
suspension. In case of suspended notifications, releasing the returned
Guard will trigger delivery of queued or accumulated
notifications, if any.
The returned
Guard
isAutoCloseable
, which makes it convenient to use in try-with-resources.
-
release
private void release()
-
yeses
public EventStream<?> yeses()
-
noes
public EventStream<?> noes()
-
isSuspended
protected final boolean isSuspended()
-
connect
protected final Subscription connect()
Description copied from class:ValBase
Implementation of this method should start observing inputs. If the value of this Val may change as a result of input change, the corresponding input observer should callValBase.invalidate()
to notify observers of this Val. By the time of calling ValBase.invalidate(), the input observer must have already updated any internal state of this Val, so that a subsequent call toValBase.computeValue()
returns the current value of this Val.
-
computeValue
protected final java.lang.Boolean computeValue()
- Specified by:
computeValue
in classValBase<java.lang.Boolean>
-
-