ZK Developer's Guide
ZK Developer's Guide
ZK Developer's Guide
- TAGS
- guide
- iknow.seforge.org
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Now we will implement doInit() and doAfterCompose().<br />
package sample;<br />
import org.zkoss.zk.ui.Page;<br />
import org.zkoss.zk.ui.util.Initiator;<br />
public class InitSample implements Initiator<br />
{<br />
public void doAfterCompose(Page page) throws<br />
Exception<br />
{<br />
System.out.println("doAfterCompose");<br />
}<br />
public void doInit(Page page, Object[] args) throws<br />
Exception<br />
{<br />
System.out.println("doInit");<br />
}<br />
public void doCatch(Throwable throwable)<br />
{<br />
}<br />
public void doFinally()<br />
{<br />
}<br />
}<br />
The result is the following output:<br />
doInit<br />
class sample.InitSample<br />
doAfterCompose<br />
The init sequence is called before the zscript, and therefore, your import<br />
has no consequence for that sequence. Instead of writing an init class you<br />
can do the necessary actions in a ZUL file (init.zs).<br />
Phase: Component Creation<br />
In this phase, the <strong>ZK</strong> loader is responsible for the interpretation of the pages. The<br />
components of each page are created and initialized.<br />
The following steps are performed in this phase:<br />
Composing Phase<br />
[ 21 ]<br />
Chapter 1<br />
Step 1: Before the creation and initialization is started, the optional values of if<br />
and unless attributes are evaluated ( or ). With these attributes it's possible to control the layout<br />
depending on some conditions.