Modal dialog with delayed closing


Summary:

  • I would like to present a modal dialog (window) to user.
  • The dialog should be visible for some specified amount of time (e.g. 50 seconds)
  • After the time is up the dialog (window) should be programmatically closed. (not in response to user action, not in response to mouse moved, etc.)


Scenario:

  • There are times when we need to re-deploy the application in production. Prior to re-deploy and during the operation we’d like the user to be informed about what is happening and prevent them from doing other activities during this short period of time.
  • The deploy operation may take 45 seconds.
  • A
    Refresher
    (http://vaadin.com/directory#addon/refresher:vaadin) is used to check periodically for alerts (like an application re-deploy) on the server. When a re-deploy is detected, the Refresher is reconfigured (by adjusting its interval) so that no refresh operations will be done during the time the application restart is expected to occur.
  • At this point I wish to present something visual (e.g. modal dialog with process bar and message). So now, I believe, we are completely client-side. So it would seem that the client would need to manage this (in straight javascript I’d use a
    setTimeout(…)
    ).
  • Then after the set amount of time close the modal dialog, reset the refresher interval and go on using the application.

Any suggestions? Sample code? etc.?

Many thanks (Vaadin Rocks!!!)

javapda