Class AbstractController
- java.lang.Object
-
- net.sourceforge.pmd.util.fxdesigner.app.AbstractController
-
- All Implemented Interfaces:
javafx.fxml.Initializable
,ApplicationComponent
,SettingsOwner
- Direct Known Subclasses:
EventLogController
,MainDesignerController
,MetricPaneController
,NodeDetailPaneController
,RuleEditorsController
,ScopesPanelController
,SourceEditorController
,TestCollectionController
,TestExportWizardController
,TreeExportWizardController
,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:
- Property binding: the child exposes some property, the parent links it to another child or exposes it again
MessageChannel
sAppServiceDescriptor
s
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 Summary
Constructors Modifier Constructor Description protected
AbstractController(DesignerRoot root)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterChildrenInit()
Runs once after every child has finished their initialization.void
afterParentInit()
Executed after the parent's initialization (so afterafterChildrenInit()
).protected void
beforeParentInit()
Executed before the parent's initialization.java.util.List<AbstractController>
getChildren()
java.util.List<? extends SettingsOwner>
getChildrenSettingsNodes()
Gets the children of this node in order.DesignerRoot
getDesignerRoot()
void
initialize(java.net.URL url, java.util.ResourceBundle resourceBundle)
void
shutdown()
Standard shutdown procedure.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.util.fxdesigner.app.ApplicationComponent
getDebugName, getGlobalLanguageVersion, getLogCategory, getLogger, getMainStage, getService, globalLanguageProperty, isDeveloperMode, languageBindingsProperty, logInternalDebugInfo, logInternalDebugInfo, logInternalException, logUserException, raiseParsableSourceFlag, raiseParsableXPathFlag
-
-
-
-
Constructor Detail
-
AbstractController
protected AbstractController(DesignerRoot root)
-
-
Method Detail
-
getDesignerRoot
public DesignerRoot getDesignerRoot()
- Specified by:
getDesignerRoot
in interfaceApplicationComponent
-
initialize
public final void initialize(java.net.URL url, java.util.ResourceBundle resourceBundle)
- Specified by:
initialize
in interfacejavafx.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 afterafterChildrenInit()
). 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 theirafterParentInit()
.
-
shutdown
public void shutdown()
Standard shutdown procedure. Override but call super.shutdown() to shutdown children recursively.
-
getChildrenSettingsNodes
public java.util.List<? extends SettingsOwner> getChildrenSettingsNodes()
Description copied from interface:SettingsOwner
Gets the children of this node in order.- Specified by:
getChildrenSettingsNodes
in interfaceSettingsOwner
-
getChildren
public java.util.List<AbstractController> getChildren()
-
-