rx.javafx.sources.DialogSource Maven / Gradle / Ivy
package rx.javafx.sources;
import javafx.scene.control.Dialog;
import java.util.Optional;
import rx.Observable;
import rx.schedulers.JavaFxScheduler;
public final class DialogSource {
private DialogSource() {}
public static Observable fromDialogSource(final Dialog dialog) {
return Observable.fromCallable(dialog::showAndWait)
.subscribeOn(JavaFxScheduler.getInstance())
.filter(Optional::isPresent)
.map(Optional::get);
}
}