Source :
<?xml version="1.0" encoding="UTF-8"?>
<zk>
<zscript><![CDATA[
int i = 0;
]]></zscript>
<groupbox id="gb" closable="false" sclass="z-demo-config" width="400px">
<caption label="ZK Logging Monitor" />
<timer id="timer" delay="1000" repeats="true">
<attribute name="onTimer">
Label l = new Label("New Record Logged : " + ++i + " --> Hash : " + execution.hashCode());
l.setAction("show: slideDown");
if (list.getChildren().size() != 0) {
list.insertBefore(l, (Component) list.getChildren().get(0));
} else {
l.setParent(list);
}
</attribute>
</timer>
<vlayout id="list" style="background: #FEFFCD; overflow:scroll; overflow-x:hidden"
action="show: slideDown;hide: slideUp" height="150px" />
</groupbox>
<zk>
<zscript><![CDATA[
void ToggleLogging() {
if (timer.isRunning()) {
timer.stop();
list.setVisible(false);
Label result = new Label("All " + i + " Record(s)");
result.setId("result");
btnCtrl.setLabel("Continue Recording");
result.setParent(gb);
} else {
btnCtrl.setLabel("Stop Recording");
result.detach();
list.setVisible(true);
timer.start();
}
}
]]></zscript>
<button id="btnCtrl" label="Stop Logging" onClick="ToggleLogging()" />
</zk>
</zk>
Hasil :