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

JavaViewStep needs a codeBehind method too #350

Closed
mipastgt opened this issue Jan 16, 2016 · 3 comments
Closed

JavaViewStep needs a codeBehind method too #350

mipastgt opened this issue Jan 16, 2016 · 3 comments
Labels
Milestone

Comments

@mipastgt
Copy link

You currently can create custom controls as FXML views by using the "root" and "codeBehind" methods of the FxmlViewStep. But if you want to use the same scheme with pure Java views, this does not work because the JavaViewStep does not have the corresponding "codeBehind" method. It would be nice if such a method could be added.

Here is a code example which shows the problem:

public class AboutView extends HBox implements JavaView<AboutViewModel> {

    @InjectViewModel
    private AboutViewModel viewModel;

    @InjectResourceBundle
    private ResourceBundle resources;

    public AboutView() {
        String aboutText;
        try {
            FluentViewLoader.javaView(AboutView.class).codeBehind(this).load(); // Here is the problem
            aboutText = resources.getString("about.text");
        } catch (Exception e) {
            aboutText = "???";
        }

        Label description = new Label(aboutText);
        setSpacing(10);
        setPadding(new Insets(20));
        getChildren().add(description);
    }

}
@manuel-mauky
Copy link
Collaborator

Hi,
thanks for your request. In our projects we were almost only using fxml views in the past so our focus wasn't on the java-only feature. But of cause your request is valid and I will add this feature in the next release.

@manuel-mauky
Copy link
Collaborator

The implementation of this was surprisingly easy. You can try it with the version 1.5.0-SNAPSHOT that is pushed to the maven central snapshot repo. Please give feedback if everything works fine for your use case.

@mipastgt
Copy link
Author

Thank you very much for the quick response. I've tried it out and it works for me :-)

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

No branches or pull requests

2 participants