01: /* EventListener.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Fri Jul 22 16:06:46 2005, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2005 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.zk.ui.event;
20:
21: import org.zkoss.zk.ui.UiException;
22:
23: /**
24: * An listener that will be notified when an event occurs, if it is
25: * registered to {@link org.zkoss.zk.ui.Component#addEventListener}.
26: *
27: * <p>If an event listener also implements {@link Deferrable}
28: * and {@link Deferrable#isDeferrable} returns true, the event
29: * for the listener will NOT be sent to the server immediately (when it
30: * is fired at the client). It is called the deferrable event listener.
31: * It helps to improve the performance since the deferred events will
32: * be 'packed' together and sent to the server at once. It is usully used
33: * for event listeners that maintains the application states, rather
34: * than generating visual responses.
35: *
36: * <p>By default (i.e., if {@link Deferrable} is not implemented), the event
37: * listener is not deferrable. It is also called the ASAP event listener.
38: *
39: * <p>If an event listener also implements {@link Express}, the event
40: * listener is evaluated before all other listeners, including the onXxx members
41: * declared in the ZUML page.
42: *
43: * <p>By default (i.e., if {@link Express} is not implemented,
44: * the event listener is eveluated after the onXxx members declared
45: * in the ZUML page, but before the onXxx methods declared in the
46: * component class.
47: *
48: * @author tomyeh
49: * @see Deferrable
50: * @see Express
51: */
52: public interface EventListener {
53: /** Notifies this listener that an event occurs.
54: * To get the event, you have to register it first by use of
55: * {@link org.zkoss.zk.ui.Component#addEventListener} or
56: * {@link org.zkoss.zk.ui.Page#addEventListener}.
57: *
58: * <p>If you want to forward the event to other component,
59: * use {@link Events#sendEvent}.
60: */
61: public void onEvent(Event event) throws Exception;
62: }
|