Separate Main Windows (Shadow Customer)

I have set up a separate main window based on access rights.

e.g. If an admin logs in it takes you to one main window screen, and if a customer logs in another

What I am trying to do now is set up a method of shadowing the customers screen from the admin area. What I have done:

public void onCustomerPortalButtonClick() {
    Map<String, Objectparams = new HashMap<String, Object>();
    params.put("Account", accountsTable.getSingleSelected());
    final Window portalwindow = openWindow("customerMainWindow", WindowManager.OpenType.DIALOG, params);
    portalwindow.addCloseListener(event ->{
        portalwindow.close("", true);
    });
}

Is there a method to open the window as a new browser window or something? What I have done sort of works however I get this error whenever I try and close the window:
UnsupportedOperationException: Close operation for TopLevelWindow is unsupported

Maybe there is a better way to do all this?

It sortof works if I do:

this.openFrame(this, "customerMainWindow", params);

But I would prefer it in a separate tab.

Hi,
What do you mean by this?

Do you want to simply change the opened main window on button click or it is more complex logic?

I want another main window inside the main window as a tab. I have somewhat solved this.

I’d recommend that you use different Frame screens instead of multiple main windows. But if you really need to switch between main windows you can use App.navigateTo(screenId) method.

App.getInstance().navigateTo("adminMainWindow");

As you noticed Window.close() operation is not supported for main window and we are not planning to introduce it in the future.