ZK Developer's Guide
ZK Developer's Guide
ZK Developer's Guide
- TAGS
- guide
- iknow.seforge.org
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Getting Started with <strong>ZK</strong><br />
Event Processing Thread—Initialize and Cleanup<br />
One important thread in a <strong>ZK</strong> application is the event processing thread. In this<br />
thread an event listener is processed.<br />
Sometimes there is a demand to initialize or clean up the thread. For this we have<br />
the org.zkoss.zk.ui.event.EventThreadInit-interface. This interface has the<br />
method init(Component, Event) which must be implemented (and the prepare<br />
method). To register the listener it's necessary to make an entry in WEB-INF/zk.xml.<br />
<br />
<br />
sample.SampleEventThreadInit<br />
stener><br />
<br />
For cleanup there is the org.zkoss.zk.ui.event.EventThreadCleanup interface.<br />
Here, we have to implement the cleanup(Component, Event, List)method;<br />
additionally we also have to implement the complete method. The last parameter for<br />
the method cleanup is a list of exceptions that occur before the method is executed.<br />
To register the listener it's necessary to make an entry in WEB-INF/zk.xml.<br />
<br />
<br />
sample.SampleEventThreadCleanup<br />
<br />
<br />
An example implementation of such a listener is shown in Appendix A.<br />
Until now we have used ZUML, but we haven't really explained what ZUML is<br />
and how to use it. The next section should you give some idea about working with<br />
ZUML. Before we start, it's important to note that the next section is not a reference<br />
for ZUML, it's just a guide to help in the development of a ZUML page.<br />
Event Types<br />
The following event types exist in <strong>ZK</strong>:<br />
•<br />
•<br />
•<br />
•<br />
•<br />
•<br />
Mouse Events (e.g. onClick)<br />
Keystroke Events (e.g. onOK)<br />
Input Events (e.g. onChange)<br />
List and Tree Events (e.g. onSelect)<br />
Slider and Scroll Events (e.g. onScroll)<br />
Other Events (e.g. onZIndex)<br />
[ 28 ]