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) {
[b]
app.getMainWindow().removeWindow(popupRiskDataWindow);
[/b] presenter.navigateToClientView(task);
}
});
app.getMainWindow().addWindow(popupRiskDataWindow);
}
I explicity remove the window before navigation.
See the screen shots attached