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.
Removing sub Window does strange behaviour
I have a requirement Where in i have show a popupwindow and when user closes the subwindow i have to navigate to another view. I used window close listener to achieve this.
When the user closes the subwindow my application navigates to the required page but in the new page i still see a small subwindow which it should not.
Here is the method i have written
private void handleRiskDataDisplay(final ThreatInfoComponent riskData,
final DailyTask task) {
// TODO Auto-generated method stub
final HCMUApplication app = (HCMUApplication) BaseApplication
.getInstance();
final Window popupRiskDataWindow = new Window();
// popupWindow.addStyleName("HCMUTreatmentInfoPopupWindow");
popupRiskDataWindow.setModal(true);
popupRiskDataWindow.setDraggable(false);
popupRiskDataWindow.setResizable(false);
popupRiskDataWindow.setScrollable(false);
popupRiskDataWindow.setClosable(true);
popupRiskDataWindow.center();
popupRiskDataWindow.addComponent(riskData);
VerticalLayout content = (VerticalLayout) popupRiskDataWindow
.getContent();
content.setSizeUndefined();
content.setMargin(true);
// Add window closing listener
popupRiskDataWindow.addListener(new Window.CloseListener() {
private static final long serialVersionUID = 2903662733997645927L;
@Override
public void windowClose(CloseEvent e) {
app.getMainWindow().removeWindow(popupRiskDataWindow); presenter.navigateToClientView(task);
}
});
app.getMainWindow().addWindow(popupRiskDataWindow);
}
I explicity remove the window before navigation.
See the screen shots attached
Solved using
for (Window w : app.getMainWindow().getChildWindows()) {
app.getMainWindow().removeWindow(w);
}
But don't know why two windows are getting added.