@Test public void setStylesheetPostAsync() throws ExecutionException, InterruptedException { Try.of(() -> testStage) .map(Stages::scheduleDisplaying) .map(cs -> Stages.setStylesheet(cs, TEST_STYLE)) .get() .toCompletableFuture() .get(); await().until(() -> testStage.getScene().getStylesheets().contains(TEST_STYLE.getExternalForm())); assertThat(testStage.getScene().getStylesheets()).containsExactly(TEST_STYLE.getExternalForm()); }
public static CompletionStage<Stage> setStylesheet(final Stage stage, final String stylesheet) { LOG.info( "Setting stylesheet {} for stage {}({})", stylesheet, stage.toString(), stage.getTitle() ); return FxAsync.doOnFxThread( stage, theStage -> { final Scene stageScene = theStage.getScene(); stageScene.getStylesheets().clear(); stageScene.getStylesheets().add(stylesheet); } ); }
Stages { public static CompletionStage<Stage> setStylesheet(final Stage stage, final String stylesheet) { LOG.info( "Setting stylesheet {} for stage {}({})", stylesheet, stage.toString(), stage.getTitle() ); return FxAsync.doOnFxThread( stage, theStage -> { final Scene stageScene = theStage.getScene(); stageScene.getStylesheets().clear(); stageScene.getStylesheets().add(stylesheet); } ); } }
Stages { public static CompletionStage<Stage> setStylesheet(final Stage stage, final String stylesheet) { LOG.info( "Setting stylesheet {} for stage {}({})", stylesheet, stage.toString(), stage.getTitle() ); return FxAsync.doOnFxThread( stage, theStage -> { final Scene stageScene = theStage.getScene(); stageScene.getStylesheets().clear(); stageScene.getStylesheets().add(stylesheet); } ); } private  Stages(); }
Stages { public static CompletionStage<Stage> setStylesheet(final Stage stage, final String stylesheet) { LOG.info( "Setting stylesheet {} for stage {}({})", stylesheet, stage.toString(), stage.getTitle() ); return FxAsync.doOnFxThread( stage, theStage -> { final Scene stageScene = theStage.getScene(); stageScene.getStylesheets().clear(); stageScene.getStylesheets().add(stylesheet); } ); } private  Stages(); static CompletionStage<Stage> stageOf(final String title, final Pane rootPane); static CompletionStage<Stage> scheduleDisplaying(final Stage stage); static CompletionStage<Stage> scheduleDisplaying(final CompletionStage<Stage> stageCreationResult); static CompletionStage<Stage> scheduleHiding(final Stage stage); static CompletionStage<Stage> scheduleHiding(final CompletionStage<Stage> stageCreationResult); static CompletionStage<Stage> setStylesheet(final Stage stage, final String stylesheet); static CompletionStage<Stage> setStylesheet(final CompletionStage<Stage> stageCreationResult, final String stylesheet); static CompletionStage<Stage> setStylesheet(final Stage stage, final FxmlStylesheet stylesheet); static CompletionStage<Stage> setStylesheet(final CompletionStage<Stage> stageCreationResult, final FxmlStylesheet stylesheet); }
Stages { public static CompletionStage<Stage> setStylesheet(final Stage stage, final String stylesheet) { LOG.info( "Setting stylesheet {} for stage {}({})", stylesheet, stage.toString(), stage.getTitle() ); return FxAsync.doOnFxThread( stage, theStage -> { final Scene stageScene = theStage.getScene(); stageScene.getStylesheets().clear(); stageScene.getStylesheets().add(stylesheet); } ); } private  Stages(); static CompletionStage<Stage> stageOf(final String title, final Pane rootPane); static CompletionStage<Stage> scheduleDisplaying(final Stage stage); static CompletionStage<Stage> scheduleDisplaying(final CompletionStage<Stage> stageCreationResult); static CompletionStage<Stage> scheduleHiding(final Stage stage); static CompletionStage<Stage> scheduleHiding(final CompletionStage<Stage> stageCreationResult); static CompletionStage<Stage> setStylesheet(final Stage stage, final String stylesheet); static CompletionStage<Stage> setStylesheet(final CompletionStage<Stage> stageCreationResult, final String stylesheet); static CompletionStage<Stage> setStylesheet(final Stage stage, final FxmlStylesheet stylesheet); static CompletionStage<Stage> setStylesheet(final CompletionStage<Stage> stageCreationResult, final FxmlStylesheet stylesheet);  }