@Unstable(reason="class was recently added") public class FxToolkit extends Object
Overview
This class methods cover three different kinds of fixtures:
registeredStage
.registeredStage
.registeredStage
.Additionally it keeps an internal context.
1. Container Fixtures
They can be registered as registeredStage
and provide a top-level container, i.e.
Stage
s.
The primary stage can be registered as registeredStage
using
registerPrimaryStage()
. This call is mandatory before any other JavaFX fixture can be
created.
Other stages can be registered as registeredStage
using registerStage(Supplier<Stage>)
.
2. Content Fixtures
They can be attached to the registeredStage
.
Either constructed by calling an Application.start()
, by
supplying Scene
s, Parent
s, or by consuming a Stage
.
Use: setupStage(Consumer<Stage>)
,
setupApplication(Class<? extends Application>)?>
,
setupScene(Supplier<Scene>)
or
setupSceneRoot(Supplier<Parent>)
3. Individual Fixtures
To setup individual Stages, Scenes or Nodes use setupFixture(Runnable)
and
setupFixture(Callable)
.
Internal Context
Is internally responsible for handle the registered Stage for attachments, handle timeouts, provide the Application for the Toolkit launch and execute the setup in the JavaFX thread. The primary Stage is constructed by the platform.
Modifier and Type | Method and Description |
---|---|
static void |
cleanupApplication(Application application) |
static void |
cleanupApplication(ApplicationFixture applicationFixture) |
static void |
cleanupStages() |
static void |
hideStage() |
static Stage |
registerPrimaryStage() |
static Stage |
registerStage(Supplier<Stage> stageSupplier) |
static ApplicationFixture |
setupApplication(ApplicationFixture applicationFixture) |
static Application |
setupApplication(Class<? extends Application> applicationClass,
String... applicationArgs) |
static <T> T |
setupFixture(Callable<T> callable) |
static void |
setupFixture(Runnable runnable) |
static Scene |
setupScene(Supplier<Scene> sceneSupplier) |
static Parent |
setupSceneRoot(Supplier<Parent> sceneRootSupplier) |
static Stage |
setupStage(Consumer<Stage> stageConsumer) |
static void |
showStage() |
static FxToolkitContext |
toolkitContext() |
@Unstable(reason="is missing apidocs") public static Stage registerPrimaryStage() throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static Stage registerStage(Supplier<Stage> stageSupplier) throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static Stage setupStage(Consumer<Stage> stageConsumer) throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static Application setupApplication(Class<? extends Application> applicationClass, String... applicationArgs) throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static ApplicationFixture setupApplication(ApplicationFixture applicationFixture) throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static void cleanupApplication(Application application) throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static void cleanupApplication(ApplicationFixture applicationFixture) throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static Scene setupScene(Supplier<Scene> sceneSupplier) throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static Parent setupSceneRoot(Supplier<Parent> sceneRootSupplier) throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static void setupFixture(Runnable runnable) throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static <T> T setupFixture(Callable<T> callable) throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs; could change to accept stages") public static void showStage() throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static void hideStage() throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static void cleanupStages() throws TimeoutException
TimeoutException
@Unstable(reason="is missing apidocs") public static FxToolkitContext toolkitContext()