java.lang.Object
no.ntnu.principes.controller.StageController
Controls a JavaFX Stage with screen management capabilities.
Handles stage configuration, theme switching, event handlers, and global keyboard shortcuts.
Each StageController manages one Stage and its associated ScreenController.
-
Constructor Summary
ConstructorsConstructorDescriptionStageController(String name, double width, double height) Creates a new StageController with a new Stage.StageController(String name, javafx.stage.Stage stage, double width, double height) Creates a new StageController with an existing Stage.StageController(String name, javafx.stage.Stage stage, double width, double height, boolean isUtility) Creates a new StageController with an existing Stage and utility flag. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the stage, its screen controller, and tears down event handlers.booleanChecks if this is the main stage.voidRegisters all available screens with the ScreenController.voidsetWindowHeight(double windowHeight) Sets the window height and updates the stage accordingly.voidsetWindowWidth(double windowWidth) Sets the window width and updates the stage accordingly.
-
Constructor Details
-
StageController
Creates a new StageController with a new Stage.- Parameters:
name- The name used to identify this controllerwidth- The initial width of the stageheight- The initial height of the stage
-
StageController
Creates a new StageController with an existing Stage.- Parameters:
name- The name used to identify this controllerstage- The JavaFX Stage to be managedwidth- The initial width of the stageheight- The initial height of the stage
-
StageController
public StageController(String name, javafx.stage.Stage stage, double width, double height, boolean isUtility) Creates a new StageController with an existing Stage and utility flag.- Parameters:
name- The name used to identify this controllerstage- The JavaFX Stage to be managedwidth- The initial width of the stageheight- The initial height of the stageisUtility- Whether this stage is a utility stage (affects behavior)
-
-
Method Details
-
registerScreens
public void registerScreens()Registers all available screens with the ScreenController. UsesScreenRegistryto automatically find and register screens. -
setWindowHeight
public void setWindowHeight(double windowHeight) Sets the window height and updates the stage accordingly.- Parameters:
windowHeight- The new window height
-
setWindowWidth
public void setWindowWidth(double windowWidth) Sets the window width and updates the stage accordingly.- Parameters:
windowWidth- The new window width
-
isMainStage
public boolean isMainStage()Checks if this is the main stage.- Returns:
- true if this is the main stage, false otherwise
-
close
public void close()Closes the stage, its screen controller, and tears down event handlers. Performs cleanup operations for proper resource management.
-