Class BaseController

java.lang.Object
com.wellnessapp.controller.BaseController
All Implemented Interfaces:
IBaseController
Direct Known Subclasses:
MainController, MoodChartController, MoodPopupController

public class BaseController extends Object implements IBaseController
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

    Constructors
    Constructor
    Description
    Called on initialisation of any controller inheriting from BaseController.
  • Method Summary

    Modifier and Type
    Method
    Description
    javafx.stage.Stage
    Gets the stage instance by using required "base" fx:id attribute in all FXML.
    void
    Initialises access to the stage by running getStage() when the FXML thread is mounted and ready.
    void
    onMount(Runnable callback)
    The onMount method forces code execution to wait until it can be executed on the JavaFX thread when the page mount is completed.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 interface IBaseController
      Returns:
      The current stage connected to the controller.
    • onMount

      public void onMount(Runnable callback)
      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 a getStage() call before callback.
      Specified by:
      onMount in interface IBaseController
      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 running getStage() when the FXML thread is mounted and ready. The stage can be accessed through getStage() method of the BaseController. This method is unnecessary if using the onMount(Runnable) method.
      Specified by:
      initStage in interface IBaseController
      See Also: