Set one window to open by default when user login

Is it possible to set one window to open by default when user login.
Perhaps with the close button disabled for this particular window tab.

1 Like

Hi Kjell,

yes, you can do that: There is a ready method that can be called overridden in your ExtMainWindow class.
Here’s an example:

public class ExtAppMainWindow extends AppMainWindow {

     @Override
     public void ready() {
         super.ready();
         openWindow("my-initial-screen", WindowManager.OpenType.NEW_TAB);
     }
 }

Bye,
Mario

1 Like

Is it possible to prevent users from closing this tab?

Yes. Look at this topic: http://stackoverflow.com/questions/36999218/pin-a-tab-in-cuba-platform-app-or-protect-from-closing
Basically you should just override the following method in the controller:

@Override
protected boolean preClose(String actionId) {
    return false;
}
1 Like

It works but only issue I noticed is that if I have a menu item for opening the same screen (the default), then post login if I click the menu item (unlikely to do) the it opens 2 tabs of the same window.

Hi,

this is true. I faced that as well. The solution to this can be found here:
https://www.cuba-platform.com/discuss/t/opening-screen-programatically-differs-in-tab-behavior-than-manual-opening

Bye
Mario

2 Likes

Thanks for the workaround. Works great.

Hi,

I can not open above link , says doesn’t exist.

Thanks,
Saurabh