01: /* BandboxDefault.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Sep 6, 2007 2:05:56 PM , 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:
24: import org.zkoss.zk.ui.Component;
25: import org.zkoss.zk.ui.Execution;
26: import org.zkoss.zk.ui.Executions;
27: import org.zkoss.zk.ui.render.ComponentRenderer;
28: import org.zkoss.zk.ui.render.SmartWriter;
29: import org.zkoss.zul.Bandbox;
30:
31: /**
32: *
33: * {@link Bandbox}'s default mold.
34: *
35: * @author jumperchen
36: * @since 3.0.0
37: */
38: public class BandboxDefault implements ComponentRenderer {
39: public void render(Component comp, Writer out) throws IOException {
40: final SmartWriter wh = new SmartWriter(out);
41: final Bandbox self = (Bandbox) comp;
42: final String uuid = self.getUuid();
43: final Execution exec = Executions.getCurrent();
44:
45: wh
46: .write("<span id=\"")
47: .write(uuid)
48: .write("\"")
49: .write(self.getOuterAttrs())
50: .write(
51: " z.type=\"zul.cb.Bdbox\" z.combo=\"true\"><input id=\"")
52: .write(uuid).write("!real\" autocomplete=\"off\"")
53: .write(self.getInnerAttrs()).write("/><span id=\"")
54: .write(uuid).write("!btn\" class=\"rbtnbk\"");
55:
56: if (!self.isButtonVisible())
57: wh.write(" style=\"display:none\"");
58:
59: wh
60: .write("><img src=\"")
61: .write(exec.encodeURL(self.getImage()))
62: .write("\"/></span><div id=\"")
63: .write(uuid)
64: .write(
65: "!pp\" class=\"bandboxpp\" style=\"display:none\" tabindex=\"-1\">")
66: .write(self.getDropdown()).write("</div></span>");
67: }
68: }
|