How to open a particular screen at login?

I would like an entity browse screen to open when a user logs in. I’ve tried to use MainWindow but that seems to create a “work area” that gets loaded with a screen after a user chooses one. i know that you can use the URL to open a screen, but that makes for a long URL.

How can I cause a particular screen to be opened on login?

1 Like

Hi Eric,

You can do this by extending the main screen and in the controller add following code.

    public void ready() {
       // Wait for the super to be ready

        // Then load the initial screen
        openWindow("app$initial-screen", WindowManager.OpenType.THIS_TAB);

So, Noob here. Trying to interpret your instructions, I did this:

  1. Created a default main window
  2. Added the code you suggested, but I also had to import com.haulmont.cuba.gui.WindowManager

It worked. Thanks so much!

Hi Eric,

No problem - I was a noob just a few weeks before as well (still am in certain ways).

By “create a default main window” you mean, “extend the main window” (just for explanation to other users reading in).

Where did you find this in the documentation? I searched everywhere and couldn’t figure it out. Do I need to be looking in Vaadin docs or something?

As for the “create a default main window/extend the main window” question, I actually clicked on the “Create Main Window” link at the bottom of the Screens section. Then I opened that and added your code to the Controller.

Is there a different or better way to do this?

This is the exact correct way of doing it :slight_smile:



As for the documentation, I searched this forum :wink: