MFXLoader to define the properties of a view such as:
- An identifier for the view
- The FXML file of the view
- The root node of the FXML (managed by the loader, set once the view is loaded)
- The controller factory in case the controller uses parameterized constructors (optional)
- A flag to indicate whether this view should be considered the default one (useful for nav-bars/dashboards)
- A flag to indicate whether the view has been loaded (managed by the loader, set to true once the view is loaded)
- A Supplier function to convert the bean to a Node. This is useful for example in case you want
to implement a view switcher, you could produce a Button or any node you want that will handle the view switching,
for a concrete example you could see the MaterialFX's DemoController (in the demo module).
MFXLoaderBean.Builder with fluent api, it's suggested to use that instead of constructors.
You can also access the builder with the provided static method of(String, URL).
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetRoot()booleanbooleanisLoaded()static MFXLoaderBean.BuildersetBeanToNodeMapper(Supplier<Node> beanToNodeMapper) Sets the supplier used to convert this view into aNode.setControllerFactory(Callback<Class<?>, Object> controllerFactory) Sets the callback used to produce the view's controller.setDefaultView(boolean defaultView) Sets whether this view should be considered the default view.
-
Constructor Details
-
MFXLoaderBean
-
MFXLoaderBean
-
-
Method Details
-
of
-
getViewName
- Returns:
- the view's identifier
-
getFxmlFile
- Returns:
- the view's FXML file
-
getRoot
- Returns:
- the FXML file's root node
-
getControllerFactory
- Returns:
- the callback used to produce the view's controller
-
setControllerFactory
Sets the callback used to produce the view's controller. -
isDefaultView
public boolean isDefaultView()- Returns:
- whether this view should be considered the default view
-
setDefaultView
Sets whether this view should be considered the default view. -
isLoaded
public boolean isLoaded()- Returns:
- whether the view has been loaded by the loader
-
getBeanToNodeMapper
- Returns:
- the supplier used to convert this view into a
Node
-
setBeanToNodeMapper
Sets the supplier used to convert this view into aNode.
-