Package org.testfx.toolkit.impl
Class ToolkitServiceImpl
- java.lang.Object
-
- org.testfx.toolkit.impl.ToolkitServiceImpl
-
- All Implemented Interfaces:
ToolkitService
public class ToolkitServiceImpl extends java.lang.Object implements ToolkitService
-
-
Field Summary
Fields Modifier and Type Field Description private ApplicationLauncherapplicationLauncherprivate ApplicationServiceapplicationService
-
Constructor Summary
Constructors Constructor Description ToolkitServiceImpl(ApplicationLauncher applicationLauncher, ApplicationService applicationService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.Future<java.lang.Void>cleanupApplication(javafx.application.Application application)CallsApplicationService.stop(Application)on the given application.private static voidcleanupParameters(javafx.application.Application application)private javafx.application.ApplicationcreateApplication(java.lang.Class<? extends javafx.application.Application> applicationClass)private voidregisterApplicationParameters(javafx.application.Application application, java.lang.String... applicationArgs)java.util.concurrent.Future<javafx.application.Application>setupApplication(java.util.function.Supplier<javafx.stage.Stage> stageSupplier, java.lang.Class<? extends javafx.application.Application> applicationClass, java.lang.String... applicationArgs)Creates, initializes, and starts the given applicationClass and returns aFuturewhoseFuture.get()returns the created application.java.util.concurrent.Future<javafx.application.Application>setupApplication(java.util.function.Supplier<javafx.stage.Stage> stageSupplier, java.util.function.Supplier<javafx.application.Application> applicationSupplier, java.lang.String... applicationArgs)Creates, initializes, and starts the supplied application and returns aFuturewhoseFuture.get()returns the created application.java.util.concurrent.Future<java.lang.Void>setupFixture(java.lang.Runnable runnable)Runs the given runnable on theJavaFX Application Thread.<T> java.util.concurrent.Future<T>setupFixture(java.util.concurrent.Callable<T> callable)Runs the given callable on theJavaFX Application Thread.java.util.concurrent.Future<javafx.stage.Stage>setupPrimaryStage(java.util.concurrent.CompletableFuture<javafx.stage.Stage> primaryStageFuture, java.lang.Class<? extends javafx.application.Application> applicationClass, java.lang.String... applicationArgs)If the givenCompletableFuture.isDone(), returns that future; otherwise, launches the given application with its arguments.java.util.concurrent.Future<javafx.scene.Scene>setupScene(javafx.stage.Stage stage, java.util.function.Supplier<? extends javafx.scene.Scene> sceneSupplier)Sets the given scene as the given stage's scene on theJavaFX Application Threadand returns aFuturewhoseFuture.get()returns the given scene.java.util.concurrent.Future<javafx.scene.Parent>setupSceneRoot(javafx.stage.Stage stage, java.util.function.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 aFuturewhoseFuture.get()returns the given parent.java.util.concurrent.Future<javafx.stage.Stage>setupStage(javafx.stage.Stage stage, java.util.function.Consumer<javafx.stage.Stage> stageConsumer)Calls the stageConsumer with the given stage on theJavaFX Application Threadand returns aFuturewhoseFuture.get()returns that stage.
-
-
-
Field Detail
-
applicationLauncher
private final ApplicationLauncher applicationLauncher
-
applicationService
private final ApplicationService applicationService
-
-
Constructor Detail
-
ToolkitServiceImpl
public ToolkitServiceImpl(ApplicationLauncher applicationLauncher, ApplicationService applicationService)
-
-
Method Detail
-
setupPrimaryStage
public java.util.concurrent.Future<javafx.stage.Stage> setupPrimaryStage(java.util.concurrent.CompletableFuture<javafx.stage.Stage> primaryStageFuture, java.lang.Class<? extends javafx.application.Application> applicationClass, java.lang.String... applicationArgs)Description copied from interface:ToolkitServiceIf the givenCompletableFuture.isDone(), returns that future; otherwise, launches the given application with its arguments.- Specified by:
setupPrimaryStagein interfaceToolkitService
-
setupFixture
public java.util.concurrent.Future<java.lang.Void> setupFixture(java.lang.Runnable runnable)
Description copied from interface:ToolkitServiceRuns the given runnable on theJavaFX Application Thread.- Specified by:
setupFixturein interfaceToolkitService
-
setupFixture
public <T> java.util.concurrent.Future<T> setupFixture(java.util.concurrent.Callable<T> callable)
Description copied from interface:ToolkitServiceRuns the given callable on theJavaFX Application Thread.- Specified by:
setupFixturein interfaceToolkitService
-
setupStage
public java.util.concurrent.Future<javafx.stage.Stage> setupStage(javafx.stage.Stage stage, java.util.function.Consumer<javafx.stage.Stage> stageConsumer)Description copied from interface:ToolkitServiceCalls the stageConsumer with the given stage on theJavaFX Application Threadand returns aFuturewhoseFuture.get()returns that stage.- Specified by:
setupStagein interfaceToolkitService
-
setupScene
public java.util.concurrent.Future<javafx.scene.Scene> setupScene(javafx.stage.Stage stage, java.util.function.Supplier<? extends javafx.scene.Scene> sceneSupplier)Description copied from interface:ToolkitServiceSets the given scene as the given stage's scene on theJavaFX Application Threadand returns aFuturewhoseFuture.get()returns the given scene.- Specified by:
setupScenein interfaceToolkitService
-
setupSceneRoot
public java.util.concurrent.Future<javafx.scene.Parent> setupSceneRoot(javafx.stage.Stage stage, java.util.function.Supplier<? extends javafx.scene.Parent> sceneRootSupplier)Description copied from interface:ToolkitServiceWraps the parent in a scene, sets that scene as the given stage's scene on theJavaFX Application Thread, and returns aFuturewhoseFuture.get()returns the given parent.- Specified by:
setupSceneRootin interfaceToolkitService
-
setupApplication
public java.util.concurrent.Future<javafx.application.Application> setupApplication(java.util.function.Supplier<javafx.stage.Stage> stageSupplier, java.lang.Class<? extends javafx.application.Application> applicationClass, java.lang.String... applicationArgs)Description copied from interface:ToolkitServiceCreates, initializes, and starts the given applicationClass and returns aFuturewhoseFuture.get()returns the created application.- Specified by:
setupApplicationin interfaceToolkitService
-
setupApplication
public java.util.concurrent.Future<javafx.application.Application> setupApplication(java.util.function.Supplier<javafx.stage.Stage> stageSupplier, java.util.function.Supplier<javafx.application.Application> applicationSupplier, java.lang.String... applicationArgs)Description copied from interface:ToolkitServiceCreates, initializes, and starts the supplied application and returns aFuturewhoseFuture.get()returns the created application.- Specified by:
setupApplicationin interfaceToolkitService
-
cleanupApplication
public java.util.concurrent.Future<java.lang.Void> cleanupApplication(javafx.application.Application application)
Description copied from interface:ToolkitServiceCallsApplicationService.stop(Application)on the given application.- Specified by:
cleanupApplicationin interfaceToolkitService
-
createApplication
private javafx.application.Application createApplication(java.lang.Class<? extends javafx.application.Application> applicationClass) throws java.lang.Exception- Throws:
java.lang.Exception
-
registerApplicationParameters
private void registerApplicationParameters(javafx.application.Application application, java.lang.String... applicationArgs)
-
cleanupParameters
private static void cleanupParameters(javafx.application.Application application)
-
-