Module org.testfx

Interface ToolkitService

  • All Known Implementing Classes:
    ToolkitServiceImpl

    public interface ToolkitService
    Interface that handles setting up an Application, Stage, Scene, or rootNode and application cleanup on the JavaFX Application Thread.
    • Method Summary

      Modifier and Type Method Description
      Future<Void> cleanupApplication​(javafx.application.Application application)
      Calls ApplicationService.stop(Application) on the given application.
      Future<javafx.application.Application> setupApplication​(Supplier<javafx.stage.Stage> stageSupplier, Class<? extends javafx.application.Application> applicationClass, String... applicationArgs)
      Creates, initializes, and starts the given applicationClass and returns a Future whose Future.get() returns the created application.
      Future<javafx.application.Application> setupApplication​(Supplier<javafx.stage.Stage> stageSupplier, Supplier<javafx.application.Application> applicationSupplier, String... applicationArgs)
      Creates, initializes, and starts the supplied application and returns a Future whose Future.get() returns the created application.
      Future<Void> setupFixture​(Runnable runnable)
      Runs the given runnable on the JavaFX Application Thread.
      <T> Future<T> setupFixture​(Callable<T> callable)
      Runs the given callable on the JavaFX Application Thread.
      Future<javafx.stage.Stage> setupPrimaryStage​(CompletableFuture<javafx.stage.Stage> primaryStageFuture, Class<? extends javafx.application.Application> applicationClass, String... applicationArgs)
      If the given CompletableFuture.isDone(), returns that future; otherwise, launches the given application with its arguments.
      Future<javafx.scene.Scene> setupScene​(javafx.stage.Stage stage, Supplier<? extends javafx.scene.Scene> sceneSupplier)
      Sets the given scene as the given stage's scene on the JavaFX Application Thread and returns a Future whose Future.get() returns the given scene.
      Future<javafx.scene.Parent> setupSceneRoot​(javafx.stage.Stage stage, Supplier<? extends javafx.scene.Parent> sceneRootSupplier)
      Wraps the parent in a scene, sets that scene as the given stage's scene on the JavaFX Application Thread, and returns a Future whose Future.get() returns the given parent.
      Future<javafx.stage.Stage> setupStage​(javafx.stage.Stage stage, Consumer<javafx.stage.Stage> stageConsumer)
      Calls the stageConsumer with the given stage on the JavaFX Application Thread and returns a Future whose Future.get() returns that stage.
    • Method Detail

      • setupPrimaryStage

        Future<javafx.stage.Stage> setupPrimaryStage​(CompletableFuture<javafx.stage.Stage> primaryStageFuture,
                                                     Class<? extends javafx.application.Application> applicationClass,
                                                     String... applicationArgs)
        If the given CompletableFuture.isDone(), returns that future; otherwise, launches the given application with its arguments.
      • setupFixture

        Future<Void> setupFixture​(Runnable runnable)
        Runs the given runnable on the JavaFX Application Thread.
      • setupFixture

        <T> Future<T> setupFixture​(Callable<T> callable)
        Runs the given callable on the JavaFX Application Thread.
      • setupStage

        Future<javafx.stage.Stage> setupStage​(javafx.stage.Stage stage,
                                              Consumer<javafx.stage.Stage> stageConsumer)
        Calls the stageConsumer with the given stage on the JavaFX Application Thread and returns a Future whose Future.get() returns that stage.
      • setupScene

        Future<javafx.scene.Scene> setupScene​(javafx.stage.Stage stage,
                                              Supplier<? extends javafx.scene.Scene> sceneSupplier)
        Sets the given scene as the given stage's scene on the JavaFX Application Thread and returns a Future whose Future.get() returns the given scene.
      • setupSceneRoot

        Future<javafx.scene.Parent> setupSceneRoot​(javafx.stage.Stage stage,
                                                   Supplier<? extends javafx.scene.Parent> sceneRootSupplier)
        Wraps the parent in a scene, sets that scene as the given stage's scene on the JavaFX Application Thread, and returns a Future whose Future.get() returns the given parent.
      • setupApplication

        Future<javafx.application.Application> setupApplication​(Supplier<javafx.stage.Stage> stageSupplier,
                                                                Class<? extends javafx.application.Application> applicationClass,
                                                                String... applicationArgs)
        Creates, initializes, and starts the given applicationClass and returns a Future whose Future.get() returns the created application.
      • setupApplication

        Future<javafx.application.Application> setupApplication​(Supplier<javafx.stage.Stage> stageSupplier,
                                                                Supplier<javafx.application.Application> applicationSupplier,
                                                                String... applicationArgs)
        Creates, initializes, and starts the supplied application and returns a Future whose Future.get() returns the created application.