Anyway to know my Application is ready to receive events?

I’ve got a table of buttons that when clicked will download a file sitting out on a server.

Each row has in it a button:

window.open(new ExternalResource(“http://thefilewebsite.com/thefile.jpg”, “_top”);

That statement will temporarily leave; get the file; and then come back to my app. Unfortunately, there is a small moment in time that my app does not like any button clicks. I’m trying to enable(false) then enable(true) the buttons to keep the app happy but hoping there is a cleaner way.

Two ways this will fail

  1. If the user clicks on the buttons really fast
  2. If there are more than 6 very large files (My Safari browser can only download 6 files at a time and then waits for a file to finish downloading before starting the next)

My question:
Any clean way to tell my App to Stop Receiving events until the browser is back and ready to receive them?? Will I be able to check the current URL and if it’s not my App’s URL to not do anything?

Thanks!
Dana

Okay, I’ve got half my answer figured out…

The app’s main window’s CloseListener() is triggered when leaving after:

window.open(new ExternalResource(“http://thefilewebsite.com/thefile.jpg”, “_top”);

But is there a Listener or a way for me to know when the App is Back? Most the time it comes back within a split second but it could possibly be much longer.

Window BlurListener() and FocusListener() does not work on the Main Window. Does Anything get triggered when the App come’s back? Is this possible?

Thanks!
Dana

No - there is no such listener, and there is no easy way to do this that I would be aware of.

There has been discussion about trying to detect page reloads based on the same window being re-loaded within a short time, but nothing like that is currently planned at least for the Vaadin 6 branch. If using support for multiple browser tabs, the window needs to be identified when coming back for this to work - Vaadin 7 will make that somewhat easier, but probably would not solve the whole problem.