Showing new screen from modal screen - User Registration Sample

Hello CUBA team!

I’m altering the user registration sample project to require the user to check his/her email to activate the account. One simple step that isn’t working as required is showing the “Check your email” screen I’ve created as a blank screen. The Register screen is a modal, and I’m attempting to redirect from it as a full screen:

try {
                registrationService.registerUser(getFirstName(), getLastName(), getOrganization(), getPhoneNumber(), getEmail(), getLogin(), getPassword(), getConfirmPassword());

                CheckEmailScreen checkEmailScreen = screens.create(CheckEmailScreen.class);
                notifications.create(Notifications.NotificationType.TRAY)
                        .withCaption("Created user " + getLogin())
                        .show();

                close(WINDOW_COMMIT_AND_CLOSE_ACTION);
                checkEmailScreen.show();
            } catch (MethodParametersValidationException e) {
                List<String> messages = e.getConstraintViolations().stream()
                        .map(ConstraintViolation::getMessage)
                        .collect(Collectors.toList());
                String message = Joiner.on("\n").join(messages);
                notifications.create(Notifications.NotificationType.TRAY)
                        .withCaption(message)
                        .show();
            }

This opens the new CheckEmailScreen in a modal as well. I’m hoping to discover a way to redirect from the registration modal to the new screen in a full window (check-email-screen.xml) which shows the message. Any ideas?

Thanks in advance. You all are great!
Adam

Hi,

That is correct, screens opened from a modal window also force modal. But you can show your screen in maximized mode with no resize possible, simply add the following settings to your screen XML:

<dialogMode maximized="true" resizable="false"/>

Alternatively, you can add the following annotation to your screen controller:

@DialogMode(windowMode = DialogWindow.WindowMode.MAXIMIZED, resizable = false)

Gleb

1 Like