Jmix 2.x.x "Opening Dialog Windows" documentation - additional information needed

Hello Jmix Team

Can you please extend the “Opening Dialog Windows” 2.x.x documentation here:

If you need to pass parameters to the opened view, invoke the build() terminal method, set parameters to the view, then open the window:

@Autowired
private DialogWindows dialogWindows;

private void openViewWithParams(String username) {
    DialogWindow<MyOnboardingView> window =
            dialogWindows.view(this, MyOnboardingView.class).build();
    window.getView().setUsername(username);
    window.open();
}

with additional information to explain that when the build() method is invoked, the onInit(final InitEvent event) {...} handler method of the opening view will be called. Therefore, you cannot access anything that is passed to the newly opened view with window.getView().<new view method> inside the onInit() handler of the new view, e.g. the username in the example above.

In versions 1.x.x I had been passing ScreenOptions while opening my screens and was able to access these options in the onInit() handler and I thought that this build() and window.getView().<new view method> could replace this approach but it does not and requires moving my code into the onBeforeShow(final BeforeShowEvent event) {…} handler.

This is an important design consideration and also when migrating existing code to the Flow UI.

Thank you in advance for considering this suggestion.

Best regards
Chris

Hi Chris,

That’s a good point, thanks.
We’re going to provide some sequence diagrams explaining the lifecycle of views in different use cases. So we’ll keep in mind your suggestion.

Regards,
Konstantin