org.reactfx.SuspendedWhenStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of richtextfx Show documentation
Show all versions of richtextfx Show documentation
FX-Text-Area for formatted text and other special effects.
package org.reactfx;
import javafx.beans.value.ObservableValue;
class SuspendedWhenStream extends EventStreamBase {
private final SuspendableEventStream source;
private final ObservableValue condition;
public SuspendedWhenStream(
SuspendableEventStream source,
ObservableValue condition) {
this.source = source;
this.condition = condition;
}
@Override
protected Subscription observeInputs() {
Subscription s1 = source.suspendWhen(condition);
Subscription s2 = source.subscribe(this::emit);
return s1.and(s2);
}
}