Class AbstractController

  • All Implemented Interfaces:
    javafx.fxml.Initializable, ApplicationComponent, SettingsOwner
    Direct Known Subclasses:
    EventLogController, MainDesignerController, MetricPaneController, NodeDetailPaneController, RuleEditorsController, ScopesPanelController, SourceEditorController, XPathRuleEditorController

    public abstract class AbstractController
    extends java.lang.Object
    implements javafx.fxml.Initializable, SettingsOwner, ApplicationComponent
    Base class for controllers of the app. The main window of the app is split into regions corresponding to some area of functionality. Each has its own FXML file that can be found in the fxml resource directory. Each also has its own independent controller. Since the FXML regions are nested like a tree (the JavaFX scene graph), it's natural to link the controllers in a tree too.

    Controllers communicate with the rest of the app through several mechanisms:

    This class mainly exists to make the initialization cycle of JavaFX clearer. Children controllers are initialized before their parent, but sometimes they should only perform some actions after its parent has been initialized, e.g. binding properties that depend on a restored setting or stuff. This is part of the reason why Platform.runLater(Runnable) can sometimes be enough to solve initialization problems.

    This only works if all controllers in the initialization sequence of an FXML file extend this class.

    Since:
    6.11.0
    Author:
    Clément Fournier
    • Constructor Detail

      • AbstractController

        protected AbstractController​(DesignerRoot root)
    • Method Detail

      • initialize

        public final void initialize​(java.net.URL url,
                                     java.util.ResourceBundle resourceBundle)
        Specified by:
        initialize in interface javafx.fxml.Initializable
      • beforeParentInit

        protected void beforeParentInit()
        Executed before the parent's initialization. Always executed once at the start of the initialization of this controller.
      • afterParentInit

        public void afterParentInit()
        Executed after the parent's initialization (so after afterChildrenInit()). This also means, after persistent settings restoration. If this node has no parent, then this is never executed.
      • afterChildrenInit

        protected void afterChildrenInit()
        Runs once after every child has finished their initialization. This will be run in all cases. It's only useful if the children do something useful in their afterParentInit().
      • shutdown

        public void shutdown()
        Standard shutdown procedure. Override but call super.shutdown() to shutdown children recursively.