*/
public Result load(final URL url, final ResourceBundle resources) throws IOException {
fxmlLoadingScope.enter(this);
final FXMLLoader loader = new FXMLLoader();
loader.setLocation(url);
if (resources != null) {
loader.setResources(resources);
}
loader.setBuilderFactory(injector.getInstance(FXMLComponentBuilderFactory.class));
loader.setControllerFactory(new Callback<Class<?>, Object>() {
@Override
public Object call(final Class<?> param) {
// Use our Guice injector to fetch an instance of the desired
// controller class
return param == null ? null : injector.getInstance(param);
}
});
final Node root = (Node) loader.load(url.openStream());
// Prepares the result that is being returned after loading the FXML hierarchy.
final Result result = new Result();
result.location.set(loader.getLocation());
result.resources.set(loader.getResources());
result.controller.set(loader.getController());
result.root.set(root);
result.charset.set(loader.getCharset());
fxmlLoadingScope.exit();
return result;