Modal Windows"
Line 1: | Line 1: | ||
{{ZKDevelopersGuidePageHeader}} | {{ZKDevelopersGuidePageHeader}} | ||
− | + | === Modal Windows with Servlet Thread === | |
− | + | When the event is processed in the Servlet thread (default), the execution cannot be suspended. Thus, the modal window behaves the same as the highlited window (<javadoc method="doHighlighted()">org.zkoss.zul.Window</javadoc>). At the client side, the visual effect is the same: a semi-transparent mask blocks the end user from access components other than the modal window. However, at the server side, it works just like the overlapped mode – it returns immediately without waiting for user's closing the window. | |
− | |||
− | |||
<source lang="java" > | <source lang="java" > | ||
− | win. | + | win.doModal(); //returns once the mode is changed; not suspended |
System.out.println("next"); | System.out.println("next"); | ||
</source> | </source> | ||
Line 14: | Line 12: | ||
The "next" message will be printed to the console before the end user closes the modal window. | The "next" message will be printed to the console before the end user closes the modal window. | ||
− | === | + | === Modal Windows with Event Thread === |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | If the event thread is enabled, <javdoc method="doModal">org.zkoss.zul.Window</javadoc> will suspend the current thread. Thus, the "next" message won't be shown, until the modal window is closed. | |
− | |||
− | + | When the event thread is suspended, the Servlet thread will be resumed and continue to fork another event thread to process other events, if any. Thus, the end user still have the control (such that he can close the modal window if he want). | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{{ZKDevelopersGuidePageFooter}} | {{ZKDevelopersGuidePageFooter}} |
Revision as of 04:52, 3 September 2010
This documentation is for an older version of ZK. For the latest one, please click here.
Modal Windows with Servlet Thread
When the event is processed in the Servlet thread (default), the execution cannot be suspended. Thus, the modal window behaves the same as the highlited window (Window.doHighlighted()). At the client side, the visual effect is the same: a semi-transparent mask blocks the end user from access components other than the modal window. However, at the server side, it works just like the overlapped mode – it returns immediately without waiting for user's closing the window.
win.doModal(); //returns once the mode is changed; not suspended
System.out.println("next");
The "next" message will be printed to the console before the end user closes the modal window.
Modal Windows with Event Thread
If the event thread is enabled, <javdoc method="doModal">org.zkoss.zul.Window</javadoc> will suspend the current thread. Thus, the "next" message won't be shown, until the modal window is closed.
When the event thread is suspended, the Servlet thread will be resumed and continue to fork another event thread to process other events, if any. Thus, the end user still have the control (such that he can close the modal window if he want).