Skip to content
Manuel Mauky edited this page Jul 6, 2015 · 6 revisions

de.saxsys.mvvmfx.FluentViewLoader

The FluentViewLoader class provides a fluent API to load views. You can use it for both FxmlViews and JavaViews. The result of the loading is a ViewTuple that contains the loaded codeBehind, viewModel and the root element.

Load a fxml based view

For views that extend from de.saxsys.mvvmfx.FxmlView:

ViewTuple viewTuple = FluentViewLoader.fxmlView(MyViewClass.class).load();

Parent root = viewTuple.getView();

Load a java based view

For views that extend from de.saxsys.mvvmfx.JavaView:

ViewTuple viewTuple = FluentViewLoader.javaView(MyViewClass.class).load();

Parent root = viewTuple.getView();

Load a view with a ResourceBundle

ResourceBundle resources = ...;
ViewTuple viewTuple = FluentViewLoader.fxmlView(MyViewClass.class).resourceBundle(resources).load();

Parent root = viewTuple.getView();

There are other parameters for special use cases like creating a custom controll with the fx:root-Element. This can be seen in the Example helloworld-fx-root-example.