Processing...
Description & Source Code

ZK provides predefined "Action" and "Effect" attributes to wrap some of the basic client side action implementations so developers can use them right out of the box, such as show and hide or slide up and down.

display_action.zul
<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>
display_action_ctrl.zul
<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>