By Sitansu S Swain
Assuming you want to log all UI events on the server side, please implement an
EventInterceptor like this
and then configure it in your zk.xml as below
<listener>
<listener-class>foo.LogEventInterceptor</listener-class>
</listener>
For a simple zul file like this
<window border="normal" title="Intercepting UI Events demo">
<button id="helloBtn" label="Click me to Say hello"
onClick='alert("Hello !!!")'>
</button>
</window>
then clicking on helloBtn will generate following log on server console
onClick event received for + helloBtn !!!
[1]: http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/util/EventInterceptor.html
[2]: http://books.zkoss.org/wiki/ZK_Configuration_Reference/zk.xml/The_listener_Element/The_org.zkoss.zk.ui.util.EventInterceptor_interface
Assuming you want to log all UI events on the server side, please implement an
EventInterceptor like this
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.util.EventInterceptor;
public class LogEventInterceptor implements EventInterceptor {
public Event beforeProcessEvent(Event event) {
System.out.println(event.getName() + " event received for + "
+ event.getTarget().getId() + "!!!");
return event;
}
// rest of the impland then configure it in your zk.xml as below
<listener>
<listener-class>foo.LogEventInterceptor</listener-class>
</listener>
For a simple zul file like this
<window border="normal" title="Intercepting UI Events demo">
<button id="helloBtn" label="Click me to Say hello"
onClick='alert("Hello !!!")'>
</button>
</window>
then clicking on helloBtn will generate following log on server console
onClick event received for + helloBtn !!!
[1]: http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/util/EventInterceptor.html
[2]: http://books.zkoss.org/wiki/ZK_Configuration_Reference/zk.xml/The_listener_Element/The_org.zkoss.zk.ui.util.EventInterceptor_interface
No comments:
Post a Comment