I fixed the ticket filled by Joonas. Today I saw spotted your forum post. I’d still want to give you two hints with Vaadin coding.
First of all, avoid calling init method multiple times. It is meant to build the main screen show to the user when the application is instantiated. It just makes things more complicated to use it to do other things too. Extra methods don’t cost you anything.
The second thing I’d suggest to change is resetting the main window. You should have window.open() there too to get you “new main window” visible. That needs a complete reload on client side, (and ultimately causing flickering especially in FF). You might also face some problems with uri handlers and parameter handlers. The same thing goes for all top level window changes: avoid them if you can. Most commonly this is achieved by making you views extending layouts instead of windows.
With these hints, your test app could become something like this:
private Window loginSubWindow;
@Override
public void init() {
showLoginForm();
}
public void onLogin(LoginEvent event) {
setUser(event.getLoginParameter("username"));
getMainWindow().removeWindow(loginSubWindow);
getMainWindow().addComponent(new Label("Logged in as " + getUser()));
}
private void showLoginForm() {
setMainWindow(new Window());
loginSubWindow = new Window("Login");
getMainWindow().addWindow(loginSubWindow);
loginSubWindow.getContent().setHeight("150px");
loginSubWindow.getContent().setWidth("400px");
LoginForm loginForm = new LoginForm();
loginForm.addListener(this);
loginSubWindow.addComponent(loginForm);
loginSubWindow.center();
With 6.1.4. it looks better, even the “false” is still displayed for a very short time (usually not visible) but this doesn’t bother me. However, there are still two things broken: