Use Event Queues"
(Created page with '{{ZKDevelopersReferencePageHeader}} =Version History= {{LastUpdated}} {| border='1px' | width="100%" ! Version !! Date !! Content |- | | | |} {{ZKDeveloper…') |
|||
Line 1: | Line 1: | ||
{{ZKDevelopersReferencePageHeader}} | {{ZKDevelopersReferencePageHeader}} | ||
+ | |||
+ | The [[ZK Developer's Reference/Event Handling/Event Queues|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 [http://code.google.com/appengine/ Google App Engine]. | ||
+ | |||
+ | In additions, it will start [[ZK Developer's Reference/Server Push|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 <javadoc method="enableServerPush(org.zkoss.zk.ui.sys.ServerPush)" type="interface">org.zkoss.zk.ui.sys.DesktopCtrl</javadoc>, such as: | ||
+ | <source lang="java"> | ||
+ | ((DesktopCtrl)desktop).enableServerPush( | ||
+ | new org.zkoss.zk.ui.impl.PollingServerPush(2000,5000,-1)); | ||
+ | </source> | ||
+ | |||
+ | =Example= | ||
+ | =Disable Buttons Once Clicked= | ||
=Version History= | =Version History= |
Revision as of 09:29, 2 December 2010
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 |
---|---|---|