Use Event Queues
The event queue provides a simple way to execute a so-called asynchronous event listener in parallel to other event listeners. Thus, it won't block the user from accessing other functions even if the asynchronous event listener spends a lot of time to execute.
The event queue eventually starts a working thread to invoke the asynchronous event listener, though it is transparent to the caller. Thus, it cannot be used in the environment that does not allow the use of working threads, such as Google App Engine.
In additions, it will start a server push automatically to send the UI updates back when it is ready. If you prefer to use the client polling or particular implementation, you could start it manually by by use of DesktopCtrl.enableServerPush(ServerPush), such as:
((DesktopCtrl)desktop).enableServerPush(
new org.zkoss.zk.ui.impl.PollingServerPush(2000,5000,-1));
Example
Disable Buttons Once Clicked
Version History
Version | Date | Content |
---|---|---|