01: /* RendererCtrl.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Fri Aug 19 23:44:56 2005, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2004 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.zul;
20:
21: /**
22: * This interface defines the methods components like {@link Listbox}
23: * use to notify the renderer for several circumstance.
24: *
25: * <p>Though {@link ListitemRenderer#render} is called one item a timer,
26: * a request might have several items to render. And, if the renderer
27: * implements this interface, {@link #doTry} will be called before
28: * any redering, and {@link #doFinally} will be caleld after all rendering.
29: * If any exception occurs, {@link #doCatch} will be called.
30: *
31: * <p>A typical use is to start a transaction and use it for rendering
32: * all items from the same request.
33: *
34: * @author tomyeh
35: */
36: public interface RendererCtrl {
37: /** Called before rendering any item.
38: *
39: * <p>Example, you could start an transaction here.
40: */
41: public void doTry();
42:
43: /** Called if any exception occurs when rendering items.
44: * Note: this method won't be called if exception occurs in {@link #doTry}.
45: *
46: * <p>If this method doesn't throw exception, ex is 'eaten' though
47: * rendering is terminating.
48: * Thus, if you want to bubble up the exception, you could throw it
49: * again.
50: *
51: * <p>Example, you could roll back the transaction.
52: */
53: public void doCatch(Throwable ex) throws Throwable;
54:
55: /** Invoked after all rendering are done successfully or an exception
56: * occurs.
57: *
58: * <p>If an exception occurs, {@link #doCatch} will be invoked first and
59: * then {@link #doFinally}.
60: */
61: public void doFinally();
62: }
|