You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases I need to load a view based on the FXML path because the FXML name and the view classes name are not identical.
At the moment I can load view tuples via FluentViewLoader#fxmlView or FluentViewLoader#javaView and I have to provide a class.
In my scenario I have a FXML file (some.fxml) and I have a view class with another name (MyView.java) so the name matching of FluentViewLoader will not work.
Possible solution:
provide a method in FluentViewLoader named fromFxml(String fxmlResourcePath) which can load the specified fxml and instantiate the view class which is specified by fx:controller.
My workaround at the moment:
FXMLLoader fxmlLoader = new FXMLLoader(fxmlPath);
fxmlLoader.setControllerFactory(controllerClass -> {
final MyView view = new MyView();
ViewLoaderReflectionUtils.createAndInjectViewModel(view);
return view;
});
fxmlLoader.load();
The text was updated successfully, but these errors were encountered:
In some cases I need to load a view based on the FXML path because the FXML name and the view classes name are not identical.
At the moment I can load view tuples via
FluentViewLoader#fxmlView
orFluentViewLoader#javaView
and I have to provide a class.In my scenario I have a FXML file (some.fxml) and I have a view class with another name (MyView.java) so the name matching of FluentViewLoader will not work.
Possible solution:
fromFxml(String fxmlResourcePath)
which can load the specified fxml and instantiate the view class which is specified byfx:controller
.My workaround at the moment:
The text was updated successfully, but these errors were encountered: