Window#open(resource) fires "windowClose" event???


I created custom StreamSource which I open from the main application window. I also added Window.CloseListener to the same window to logout user and stop the application when browser is closed.

To my surprise, CloseListener is called whenever i open StreamSource with Window#open(…). StreamSource opens just fine, it works perfect but I didn’t expect my application will break because i have CloseListener which stops the application. When I remove CloseListener, Window#open() works.

Am I doing something wrong? Is this expected behavior?



OK, I have to reply to myself.

“close” event is fired because target for Window#open() is window itself. But, window is not actually closed, it is still there, its content is untouched, only PDF download is offered to user.

Is it possible to open stream without opening popup or triggering “close” event?


Hi, I have got the same problem. When windowClose() is closing application, I cannot download any file in application. Does anyone know how to solve this problem ?

I’ve made workaround for this problem:

FileDownloadResource downloadResource = new FileDownloadResource(new File(filePath),

and closeListener,

      addListener(new CloseListener() {

			public void windowClose(CloseEvent e) {
if (!openingNewFile) {
				} else {
openingNewFile = false;