Class ExternalControllerFxWeaver
java.lang.Object
net.rgielen.fxweaver.core.FxWeaver
cz.masci.commons.springfx.autoconfigure.ExternalControllerFxWeaver
@Component
public class ExternalControllerFxWeaver
extends net.rgielen.fxweaver.core.FxWeaver
Extending FxWeaver class to be able to load fxml files only without controller
specification fx:controller. It set FXMLLoader controller before loading fxml
file.
- Author:
- Daniel MaĊĦek
-
Constructor Summary
ConstructorsConstructorDescriptionExternalControllerFxWeaver(org.springframework.context.ConfigurableApplicationContext context) Create ExternalControllerFXWeaver instance -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildFxmlReference(Class<?> c) Build a FXML view location reference for controller classes, based onFxmlViewannotation or simple classname.protected <C,V extends javafx.scene.Node>
net.rgielen.fxweaver.core.FxControllerAndView<C,V> load(Class<C> controllerClass, String location, ResourceBundle resourceBundle) Load controller instance, potentially weaved with a FXML view declaring the given class as fx:controller.Methods inherited from class net.rgielen.fxweaver.core.FxWeaver
getBean, load, load, loadController, loadController, loadController, loadController, loadView, loadView, loadView, loadView, shutdown
-
Constructor Details
-
ExternalControllerFxWeaver
public ExternalControllerFxWeaver(org.springframework.context.ConfigurableApplicationContext context) Create ExternalControllerFXWeaver instance- Parameters:
context- Spring context
-
-
Method Details
-
load
protected <C,V extends javafx.scene.Node> net.rgielen.fxweaver.core.FxControllerAndView<C,V> load(Class<C> controllerClass, String location, ResourceBundle resourceBundle) Load controller instance, potentially weaved with a FXML view declaring the given class as fx:controller.The possible FXML resource is inferred from a
FxmlViewannotation at the controller class or the simple classname and package of said class if it was not annotated like this. If the FXML file is resolvable, the defined view within will be loaded byFXMLLoader. The controller will then be instantiated based on the fx:controller attribute, using the bean factory fromFxWeaver(Callback, Runnable). If the bean factory is based on a dependency management framework such as Spring, Guice or CDI, this means that the instance will be fully managed and injected as declared.If the controller class does not come with a resolvable FXML view resource, the controller will be instantiated by the given bean factory directly.
- Overrides:
loadin classnet.rgielen.fxweaver.core.FxWeaver- Type Parameters:
V- The view typeC- The controller type- Parameters:
controllerClass- The controller class of which a weaved instance should be providedlocation- The location of the FXML view to load as a classloader resource. May benullor not resolvable, in which case the controller will be directly instantiated by the given bean factory.resourceBundle- The optionalResourceBundleto use for view creation. May benull- Returns:
- A
SimpleFxControllerAndViewcontainer with the managed instance of the requested controller and the corresponding view, if applicable - See Also:
-
FxWeaverFXMLLoader
-
buildFxmlReference
Build a FXML view location reference for controller classes, based onFxmlViewannotation or simple classname.- Overrides:
buildFxmlReferencein classnet.rgielen.fxweaver.core.FxWeaver- Parameters:
c- The class to build a FXML location for. If it does not contain aFxmlViewannotation to specify resource to load, it is assumed that the view resides in the same package, named {c.getSimpleName()}.fxml- Returns:
- a resource location suitable for loading by
Class.getResource(String)
-