Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support resource bundles for sub views via fx:include #235

Closed
2 tasks done
manuel-mauky opened this issue May 11, 2015 · 0 comments
Closed
2 tasks done

support resource bundles for sub views via fx:include #235

manuel-mauky opened this issue May 11, 2015 · 0 comments
Milestone

Comments

@manuel-mauky
Copy link
Collaborator

The fx:include tag supports the explicit definition of a resourceBundle that should be used for the included fxml file. However there are at leased 3 problems with the JavaFX default behaviour due to bugs in the FXMLLoader:

  1. You can't define a Locale. Instead FXMLLoader uses Locale.getDefault(). This is a miner problem because you can set the default in your application
  2. Loading resources for included fxml files only works when there is a resourceBundle defined for the root FXMLLoader. Otherwise a NullPointerException is thrown by the FXMLLoader.
  3. FXMLLoader uses the classloader of the root resourceBundle to load included resourceBundles. However, it is possible (and for our use case typical) that the classloader is null for a resourceBundle. This is the case when the class was loaded by the bootstrap classloader of Java. For us this means: We always get a NullPointerException when trying to load a resourceBundle for an included fxml file.

There is a bug filed for this issue but it will only be resolved for JavaFX 9. This blog post describes the problem and a possible workaround.

We should do the following:

  • make sure that there is a classloader defined for the resourceBundle. For this we could internally use the ResourceBundleWrapper proposed in the linked blog post.
  • make sure that there is always a resourceBundle defined for the root FXMLLoader even when the user doesn't provide one via the FluentViewLoader.

Note: In this issue we focus on explicit configuring a resource bundle via fx:include. In the future we may support implicit loading of resourceBundles via naming convention (see #207).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant