Package org.testfx.toolkit
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 TypeMethodDescriptioncleanupApplication
(javafx.application.Application application) CallsApplicationService.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 aFuture
whoseFuture.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 aFuture
whoseFuture.get()
returns the created application.setupFixture
(Runnable runnable) Runs the given runnable on theJavaFX Application Thread
.<T> Future
<T> setupFixture
(Callable<T> callable) Runs the given callable on theJavaFX Application Thread
.Future
<javafx.stage.Stage> setupPrimaryStage
(CompletableFuture<javafx.stage.Stage> primaryStageFuture, Class<? extends javafx.application.Application> applicationClass, String... applicationArgs) If the givenCompletableFuture.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 theJavaFX Application Thread
and returns aFuture
whoseFuture.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 theJavaFX Application Thread
, and returns aFuture
whoseFuture.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 theJavaFX Application Thread
and returns aFuture
whoseFuture.get()
returns that stage.
-
Method Details
-
setupPrimaryStage
Future<javafx.stage.Stage> setupPrimaryStage(CompletableFuture<javafx.stage.Stage> primaryStageFuture, Class<? extends javafx.application.Application> applicationClass, String... applicationArgs) If the givenCompletableFuture.isDone()
, returns that future; otherwise, launches the given application with its arguments. -
setupFixture
Runs the given runnable on theJavaFX Application Thread
. -
setupFixture
Runs the given callable on theJavaFX 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 theJavaFX Application Thread
and returns aFuture
whoseFuture.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 theJavaFX Application Thread
and returns aFuture
whoseFuture.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 theJavaFX Application Thread
, and returns aFuture
whoseFuture.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 aFuture
whoseFuture.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 aFuture
whoseFuture.get()
returns the created application. -
cleanupApplication
CallsApplicationService.stop(Application)
on the given application.
-