dooApp/FXForm2

[FEATURE_REQUEST] Pass FXForm resourcebundle FXMLSkin for set in FXMLoder

Closed this issue · 8 comments

garzy commented

I'm designing an FXML form for my bean and I want to add TitledPane labels that are not bean properties, so I want to define their labels in the MyBean.properties as standar JavaFX way.

However, it i set a %some.key text in some part of fxml. This code fails because Resource bundle aren't passed to fxmlLoader instance:

protected Node loadFxml() throws NodeCreationException {
        fxmlLoader = new FXMLLoader();
        fxmlLoader.setLocation(url);
        fxmlLoader.setController(controller);
        try {
            return (Node) fxmlLoader.load();
        } catch (IOException e) {
            throw new NodeCreationException(e.getMessage(), e);
        }
    }

This code snipped from FXMLSkin should be as this example (FXForm have my resource bundle prev setted by form.setResourceBundle):

protected Node loadFxml() throws NodeCreationException {
       fxmlLoader = new FXMLLoader();
       fxmlLoader.setLocation(url);
       fxmlLoader.setController(controller);
       fxmlLoader.setResources(resourceBundleFromFXForm);
       try {
           return (Node) fxmlLoader.load();
       } catch (IOException e) {
           throw new NodeCreationException(e.getMessage(), e);
       }
   }
garzy commented

I've copy FXMLSkin to my project to make this changes and I can confirm that the feature that I need works!

In the current implementation, the labels are set by the form using its own ressource bundle. But you are right, it could be interesting to use the standard FXML way in some cases. And it should be compatible the original approach. Would you like to submit a Pull Request for this ?

garzy commented

Sure! I'm going to see and learn how to do pull request because I've never do this before

garzy commented

I believe that I make an a correct creation of the pull request.

Learning new things everyday! Thanks!

Deployed in 8.3.0-SNAPSHOT

garzy commented

OK, thanks!

garzy commented

Deployed in 8.3.0-SNAPSHOT

Hi, I have a big problem, I'm unable to found 8.3.0-SNAPSHOT with these changes in maven repo.... ¿where is the artifact?, I don't want to require to have the fxform project on my IDE for generate artifact.

Thanks

garzy commented

OK, thinking about "snapshot repository", I founded the version in the repo:

http://oss.sonatype.org/content/repositories/snapshots

I'll use this to download your artifact. Thanks