Package org.testfx.toolkit.impl
Class ToolkitServiceImpl
java.lang.Object
org.testfx.toolkit.impl.ToolkitServiceImpl
- All Implemented Interfaces:
ToolkitService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ApplicationLauncher
private final ApplicationService
-
Constructor Summary
ConstructorsConstructorDescriptionToolkitServiceImpl
(ApplicationLauncher applicationLauncher, ApplicationService applicationService) -
Method Summary
Modifier and TypeMethodDescriptioncleanupApplication
(javafx.application.Application application) CallsApplicationService.stop(Application)
on the given application.private static void
cleanupParameters
(javafx.application.Application application) private javafx.application.Application
createApplication
(Class<? extends javafx.application.Application> applicationClass) private void
registerApplicationParameters
(javafx.application.Application application, String... applicationArgs) 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.
-
Field Details
-
applicationLauncher
-
applicationService
-
-
Constructor Details
-
ToolkitServiceImpl
public ToolkitServiceImpl(ApplicationLauncher applicationLauncher, ApplicationService applicationService)
-
-
Method Details
-
setupPrimaryStage
public Future<javafx.stage.Stage> setupPrimaryStage(CompletableFuture<javafx.stage.Stage> primaryStageFuture, Class<? extends javafx.application.Application> applicationClass, String... applicationArgs) Description copied from interface:ToolkitService
If the givenCompletableFuture.isDone()
, returns that future; otherwise, launches the given application with its arguments.- Specified by:
setupPrimaryStage
in interfaceToolkitService
-
setupFixture
Description copied from interface:ToolkitService
Runs the given runnable on theJavaFX Application Thread
.- Specified by:
setupFixture
in interfaceToolkitService
-
setupFixture
Description copied from interface:ToolkitService
Runs the given callable on theJavaFX Application Thread
.- Specified by:
setupFixture
in interfaceToolkitService
-
setupStage
public Future<javafx.stage.Stage> setupStage(javafx.stage.Stage stage, Consumer<javafx.stage.Stage> stageConsumer) Description copied from interface:ToolkitService
Calls the stageConsumer with the given stage on theJavaFX Application Thread
and returns aFuture
whoseFuture.get()
returns that stage.- Specified by:
setupStage
in interfaceToolkitService
-
setupScene
public Future<javafx.scene.Scene> setupScene(javafx.stage.Stage stage, Supplier<? extends javafx.scene.Scene> sceneSupplier) Description copied from interface:ToolkitService
Sets the given scene as the given stage's scene on theJavaFX Application Thread
and returns aFuture
whoseFuture.get()
returns the given scene.- Specified by:
setupScene
in interfaceToolkitService
-
setupSceneRoot
public Future<javafx.scene.Parent> setupSceneRoot(javafx.stage.Stage stage, Supplier<? extends javafx.scene.Parent> sceneRootSupplier) Description copied from interface:ToolkitService
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.- Specified by:
setupSceneRoot
in interfaceToolkitService
-
setupApplication
public Future<javafx.application.Application> setupApplication(Supplier<javafx.stage.Stage> stageSupplier, Class<? extends javafx.application.Application> applicationClass, String... applicationArgs) Description copied from interface:ToolkitService
Creates, initializes, and starts the given applicationClass and returns aFuture
whoseFuture.get()
returns the created application.- Specified by:
setupApplication
in interfaceToolkitService
-
setupApplication
public Future<javafx.application.Application> setupApplication(Supplier<javafx.stage.Stage> stageSupplier, Supplier<javafx.application.Application> applicationSupplier, String... applicationArgs) Description copied from interface:ToolkitService
Creates, initializes, and starts the supplied application and returns aFuture
whoseFuture.get()
returns the created application.- Specified by:
setupApplication
in interfaceToolkitService
-
cleanupApplication
Description copied from interface:ToolkitService
CallsApplicationService.stop(Application)
on the given application.- Specified by:
cleanupApplication
in interfaceToolkitService
-
createApplication
private javafx.application.Application createApplication(Class<? extends javafx.application.Application> applicationClass) throws Exception - Throws:
Exception
-
registerApplicationParameters
private void registerApplicationParameters(javafx.application.Application application, String... applicationArgs) -
cleanupParameters
private static void cleanupParameters(javafx.application.Application application)
-