01: /* RowsDefault.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Sep 7, 2007 11:12:33 AM , Created by jumperchen
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.zkmax.zul.render;
20:
21: import java.io.IOException;
22: import java.io.Writer;
23: import java.util.ListIterator;
24:
25: import org.zkoss.zk.ui.Component;
26: import org.zkoss.zk.ui.render.ComponentRenderer;
27: import org.zkoss.zk.ui.render.SmartWriter;
28: import org.zkoss.zul.Rows;
29: import org.zkoss.zul.fn.ZulFns;
30:
31: /*
32: * {@link Rows}'s default mold.
33: *
34: * @author jumperchen
35: *
36: * @since 3.0.0
37: */
38: public class RowsDefault implements ComponentRenderer {
39: public void render(Component comp, Writer out) throws IOException {
40: final SmartWriter wh = new SmartWriter(out);
41: final Rows self = (Rows) comp;
42: final String uuid = self.getUuid();
43: wh.write("<tbody id=\"").write(uuid).write("\"").write(
44: self.getOuterAttrs()).write(self.getInnerAttrs())
45: .writeln(">");
46: final int from = self.getVisibleBegin(), to = self
47: .getVisibleEnd();
48: if (from < self.getChildren().size()) {
49: ListIterator it = self.getChildren().listIterator(from);
50: ZulFns.resetStripeClass(self);
51: for (int cnt = to - from + 1; it.hasNext() && --cnt >= 0;) {
52: final Component child = (Component) it.next();
53: ZulFns.setStripeClass(child);
54: child.redraw(out);
55: }
56: }
57: wh.writeln("</tbody>");
58: }
59: }
|