public abstract class FxUiManager extends Object
FxUiManager is one take on a bootstrapping class for the JavaFX UI.
The goal being both to decouple the GUI code from the main class and also to offer a somewhat declarative entry point for the JavaFX side of your project.
Every method's overriding possibilities is detailed on it.
The minimal overriding is that of :
- title() for the main stage's title.
- mainComponent() for the main scene info as a FxmlNode.
- getStylesheet() that is optionally overriden if you use a custom stylesheet. If you don't need one, ignore
it.
| Modifier | Constructor and Description |
|---|---|
protected |
FxUiManager(EasyFxml easyFxml)
You are expected to call super() with an
EasyFxml instance received from Spring. |
| Modifier and Type | Method and Description |
|---|---|
protected javafx.scene.Scene |
getScene(FxmlNode node)
|
protected Optional<FxmlStylesheet> |
getStylesheet() |
protected abstract FxmlNode |
mainComponent() |
protected void |
onSceneCreated(javafx.scene.Scene mainScene)
Called right after the main
Scene was created if you want to edit it. |
protected void |
onStageCreated(javafx.stage.Stage mainStage)
Called as we enter the
startGui(Stage) method. |
void |
startGui(javafx.stage.Stage mainStage)
Called by
FxSpringApplication after Spring and JavaFX are started. |
protected abstract String |
title() |
protected final EasyFxml easyFxml
protected FxUiManager(EasyFxml easyFxml)
EasyFxml instance received from Spring.
i.e.:
\@Component
public class MyUiManager extends FxUiManager {
\@Autowired
public MyUiManager(EasyFxml easyFxml) {
super(easyFxml);
}
...
}
easyFxml - received from Spring DIpublic void startGui(javafx.stage.Stage mainStage)
FxSpringApplication after Spring and JavaFX are started. This is the equivalent of Application.start(Stage) in traditional JavaFX apps.mainStage - The main stage of the application feeded by JavaFXprotected abstract String title()
protected abstract FxmlNode mainComponent()
protected void onSceneCreated(javafx.scene.Scene mainScene)
Scene was created if you want to edit it.mainScene - The main scene of the applicationprotected void onStageCreated(javafx.stage.Stage mainStage)
startGui(Stage) method.mainStage - The main stage, supplied by JavaFX's Application.start(Stage)
method.protected Optional<FxmlStylesheet> getStylesheet()
FxmlStylesheet to apply to the main window.protected javafx.scene.Scene getScene(FxmlNode node)
node - the node to load in the SceneSceneRuntimeException - if the scene could not be loaded properlyCopyright © 2018. All rights reserved.