Notify parent window

I have Form which has a data grid when user double clicks on the row it opens up a Modal Window.

My question is how does the Form or the parent of the Modal Window know when the user closed the Modal window so it can refresh the grid?

Thank You.


Thank you for your help.

I have the following code and the listener works when I click the ‘X’ in the modal window, but when I close the modal window with this code
((Window) getWindow().getParent()).removeWindow(getWindow());

the Window Close event never fires, how can I detect when the window was closed with either user clicking on the ‘X’ or the code?

// modal window code

	subwindow = new Window("My Modal Window");
	// create window close listener so we can refresh the grid after user closes the modal window
	subwindow.addListener(new Window.CloseListener() {

		public void windowClose(CloseEvent e) {


	VerticalLayout layout = (VerticalLayout) subwindow.getContent();

	MyForm ff = new MyForm();

Removing the window from code will not fire the close event. What you would like to do is to call window.close() which should be public but is currently protected (see
). So the options are basically:

  • Extend Window, make close public and call it.
  • Manually call the close listener after you close the window using removeWindow.

Nice solution, thanks also. :slight_smile: