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.
Extending the Online Media Library<br />
When the toolbarbutton is clicked, a modal dialog with an input field for the<br />
number of elements should appear. The appearance of the dialog is shown in the<br />
following figure:<br />
The default value of the number of elements should be initialized at the start of the<br />
page. For that, we have to provide an implementation of the org.zkoss.zk.ui.<br />
util.Initiator. interface.<br />
public class SettingsInitializer implements Initiator<br />
{<br />
public void doAfterCompose(final Page page) throws Exception<br />
{<br />
}<br />
public void doCatch(final Throwable ex)<br />
{<br />
}<br />
public void doFinally()<br />
{<br />
}<br />
public void doInit(final Page page, final Object[] args) throws<br />
Exception<br />
{<br />
InputStream in = SettingsInitializer.class.getClassLoader().<br />
getResourceAsStream("settings.properties");<br />
Properties properties = new Properties();<br />
properties.load(in);<br />
SettingsFactory.get().setNoOfElementsInResult(Integer.parseInt<br />
(properties.getProperty("noOfElementsInResult")));<br />
}<br />
}<br />
To use this implementation, we have to define the init class at the beginning of<br />
the page.<br />
<br />
[ 86 ]