java.lang.Object
com.wellnessapp.controller.BaseController
- All Implemented Interfaces:
IBaseController
- Direct Known Subclasses:
MainController
,MoodChartController
,MoodPopupController
The base controller used to abstract common logic from higher level controller classes.
Base controller can be used on any controller connected to a view excluding login / signup and
where the connected view conforms to having
fx:id=base
set on the root element.-
Constructor Summary
ConstructorDescriptionCalled on initialisation of any controller inheriting from BaseController. -
Method Summary
Modifier and TypeMethodDescriptionjavafx.stage.Stage
getStage()
Gets the stage instance by using required "base" fx:id attribute in all FXML.void
Initialises access to the stage by runninggetStage()
when the FXML thread is mounted and ready.void
The onMount method forces code execution to wait until it can be executed on the JavaFX thread when the page mount is completed.
-
Constructor Details
-
BaseController
public BaseController()Called on initialisation of any controller inheriting from BaseController. Forces application to minimise to tray when closed without exiting from system tray.
-
-
Method Details
-
getStage
public javafx.stage.Stage getStage()Gets the stage instance by using required "base" fx:id attribute in all FXML.- Specified by:
getStage
in interfaceIBaseController
- Returns:
- The current stage connected to the controller.
-
onMount
The onMount method forces code execution to wait until it can be executed on the JavaFX thread when the page mount is completed. Automatically executes agetStage()
call before callback.- Specified by:
onMount
in interfaceIBaseController
- Parameters:
callback
- A call back method for any code to be run on the JavaFX thread when ready.
-
initStage
public void initStage()Initialises access to the stage by runninggetStage()
when the FXML thread is mounted and ready. The stage can be accessed throughgetStage()
method of theBaseController
. This method is unnecessary if using theonMount(Runnable)
method.- Specified by:
initStage
in interfaceIBaseController
- See Also:
-