public abstract class StageController extends FXMLController<javafx.stage.Stage>
Stage based scenes.FXMLController| Modifier and Type | Class and Description |
|---|---|
protected class |
StageController.BackgroundTask<V>
Base class for
Task run by this stage. |
| Constructor and Description |
|---|
StageController() |
| Modifier and Type | Method and Description |
|---|---|
void |
close(boolean sync)
Close the controller's stage.
|
protected static java.util.concurrent.ScheduledExecutorService |
getExecutorService()
Get the
ScheduledExecutorService shared by all stage controllers. |
protected javafx.stage.Modality |
getModality()
This function is called during stage initialization to determine the stages's modality.
|
protected java.util.prefs.Preferences |
getPreferences()
Get the
Preferences object associated with this stage. |
protected boolean |
getResizable()
This function is called during stage initialization to determine whether the stage is resizable.
|
protected javafx.stage.StageStyle |
getStyle()
This function is called during stage initialization to determine the stages's style.
|
javafx.stage.Window |
getWindow()
Get the UI window.
|
boolean |
isBlocked()
Check whether this stage is currently blocked.
|
<R,C extends DialogController<R>> |
loadDialog(java.util.function.Function<C,javafx.scene.control.Dialog<R>> dialogFactory,
java.lang.Class<C> controllerClass)
Load and create new dialog.
|
static <C extends StageController> |
loadPrimaryStage(javafx.stage.Stage primaryStage,
java.lang.Class<C> controllerClass)
Load the JavaFX application's primary stage.
|
<C extends StageController> |
loadStage(java.lang.Class<C> controllerClass)
Load and create new stage.
|
protected void |
setBlocked(boolean blocked)
This function is called to block/unblock this stage when either the first background task has been scheduled or
the last background task has been finished.
|
protected void |
setSystemMenuBar()
This function is called on root stages to determine the system menu bar.
|
protected void |
setupStage(javafx.stage.Stage stage)
This function is called during stage initialization to perform the actual stage setup.
|
protected void |
setupUI(javafx.stage.Window owner,
javafx.stage.Stage stage,
javafx.scene.Parent fxmlRoot)
This function is called during UI initialization to perform the actual UI setup.
|
void |
show()
Show the controller's stage and return.
|
void |
showAndWait()
Show the controller's stage and wait until it is closed.
|
void |
syncPreferences()
Sync any
Preferences object associated with this stage. |
getResources, getUI, loadUIprotected static java.util.concurrent.ScheduledExecutorService getExecutorService()
ScheduledExecutorService shared by all stage controllers.ScheduledExecutorService to use for background processing.public static <C extends StageController> C loadPrimaryStage(javafx.stage.Stage primaryStage, java.lang.Class<C> controllerClass) throws java.io.IOException
This function is used to load and setup the JavaFX application's primary stage as submitted to
Application.start(Stage).
C - The actual StageController type.primaryStage - The primary stage to setup.controllerClass - The controller class to use.java.io.IOException - if an I/O error occurs during stage loading.public <C extends StageController> C loadStage(java.lang.Class<C> controllerClass) throws java.io.IOException
The newly created stage is owned by the calling controller's stage.
C - The actual controller type.controllerClass - The controller class to use.java.io.IOException - if an I/O error occurs during stage loading.public final javafx.stage.Window getWindow()
FXMLControllergetWindow in class FXMLController<javafx.stage.Stage>protected void setupUI(@Nullable
javafx.stage.Window owner,
javafx.stage.Stage stage,
javafx.scene.Parent fxmlRoot)
FXMLControllersetupUI in class FXMLController<javafx.stage.Stage>owner - The UI object's owner (may by null).stage - The constructed UI object.fxmlRoot - The scene's root node as defined by the FXML resource.public <R,C extends DialogController<R>> C loadDialog(java.util.function.Function<C,javafx.scene.control.Dialog<R>> dialogFactory, java.lang.Class<C> controllerClass) throws java.io.IOException
The newly created dialog is owned by the calling controller's stage.
R - The actual dialog result type.C - The actual controller type.dialogFactory - The factory function used to create the actual dialog object by invoking it with the
constructed controller.controllerClass - The controller class to use.java.io.IOException - if an I/O error occurs during dialog loading.protected void setSystemMenuBar()
This default implementation searches the stage scene's top level nodes for a MenuBar node and if found,
makes it the system's menu bar.
MenuBar.setUseSystemMenuBar(boolean)protected javafx.stage.StageStyle getStyle()
The default style is StageStyle.DECORATED.
StageStyleprotected javafx.stage.Modality getModality()
The default modality is Modality.WINDOW_MODAL.
Modalityprotected boolean getResizable()
The default is to make the stage resizable.
true, if the stage is resizable.protected void setupStage(javafx.stage.Stage stage)
stage - The stage to setup.protected void setBlocked(boolean blocked)
blocked - Whether the stage should blocked or unblocked.StageController.BackgroundTaskpublic boolean isBlocked()
A stage is considered block when at least one unfinished background task exists.
true if at least one unfinished background task exists.StageController.BackgroundTask@Nullable protected java.util.prefs.Preferences getPreferences()
Preferences object associated with this stage.
Override this function to associate a Preferences object with this stage.
Preferences object associated with this stage or null if there is none.public void show()
Stage.show()public void showAndWait()
Stage.showAndWait()public void close(boolean sync)
sync - Flag to control whether associated data (preferences) should synced.Stage.close(),
syncPreferences()public void syncPreferences()
Preferences object associated with this stage.
Any error encountered during syncing will be logged and discarded.
Preferences.sync()