01: /* ComponentRenderer.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Wed Sep 5 09:17:43 2007, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2007 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.render;
20:
21: import java.io.Writer;
22: import java.io.IOException;
23:
24: import org.zkoss.zk.ui.Component;
25:
26: /**
27: * A component renderer is used to render a component.
28: * In addition to DSP, JSP and other Servlet, a component can be rendered
29: * by use of a {@link ComponentRenderer} instance.
30: *
31: * <p>When {@link org.zkoss.zk.ui.AbstractComponent#redraw} is called, it
32: * retrieves the mold URI by calling {@link org.zkoss.zk.ui.AbstractComponent#getMoldURI}.
33: * Then, it returns either an URI or a {@link ComponentRenderer} instance.
34: * If URI, the component is rendered by use of {@link org.zkoss.zk.ui.Execution#include}.
35: * If {@link ComponentRenderer}, {@link #render} is called directly.
36: *
37: * <p>Note: an instance of ComponentRenderer is shared among all
38: * components of associated types.
39: *
40: * <p>The use of {@link ComponentRenderer} is mainly to speed up the
41: * performance.
42: *
43: * @author tomyeh
44: * @see Component#redraw
45: * @see org.zkoss.zk.ui.AbstractComponent#redraw
46: */
47: public interface ComponentRenderer {
48: /** Redraws a component.
49: *
50: * @param comp the component (never null).
51: * @param out the writer to generate the output (never null).
52: */
53: public void render(Component comp, Writer out) throws IOException;
54: }
|