Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
LoginForm/LoginListener and getWindow()
Dear vaadin community
In order to support multiple tabs I've overwritten the getWindow() method, as suggested in this post: https://vaadin.com/web/joonas/wiki/-/wiki/Main/Supporting+Multible+Tabs
It works fine for me, but the problem is now that the login event doesn't fire (or it doesn't arrive at the listener anymore), see the minimal code example below.
If the getWindow() method is commented out, it works without problems.
If this problem was already discussed in this forum I'm sorry, I didn't find a thread related to this subject.
Are there any suggestions to solve this problem? I would really love to support multiple tabs and be able to login at the same time. Thanks already in advance.
public class LoginTestApplication extends Application implements LoginListener, ClickListener{
private Window mainWindow,loginWindow;
private Button loginButton;
@Override
public void init(){
mainWindow = new Window("login test");
loginWindow = new Window();
LoginForm loginForm = new LoginForm();
loginForm.addListener(this);
loginWindow.setContent(loginForm);
loginButton = new Button("login");
loginButton.addListener(this);
setMainWindow(mainWindow);
mainWindow.addComponent(loginButton);
}
@Override
public Window getWindow(String name) {
Window w = super.getWindow(name);
if(w == null) {
w = new Window("test");
w.setName(name);
addWindow(w);
w.open(new ExternalResource(w.getURL()));
}
return w;
}
@Override
public void onLogin(LoginEvent event) {
System.out.println("login");
}
@Override
public void buttonClick(ClickEvent event) {
if(event.getButton()==loginButton){
mainWindow.addWindow(loginWindow);
}
}
}
Update: The problem seems to be that the LoginForm is contained in a subwindow. If it's added directly to the main window, the listener gets the event. Any suggestions for solving this problem? I actually need the LoginForm in a subwindow (and the getWindow() method).