01: /* ImagemapDefault.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Thu Sep 6 2007, Created by Jeff.Liu
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.Imagemap;
30:
31: /**
32: * {@link Imagemap}'s default and alphafix mold.
33: * @author Jeff Liu
34: * @since 3.0.0
35: */
36: public class ImagemapDefault implements ComponentRenderer {
37:
38: public void render(Component comp, Writer out) throws IOException {
39: final SmartWriter wh = new SmartWriter(out);
40: final Imagemap self = (Imagemap) comp;
41: final String uuid = self.getUuid();
42: final Execution exec = Executions.getCurrent();
43:
44: wh.write("<span id=\"").write(uuid).write(
45: "\" z.type=\"zul.widget.Map\" z.cave=\"").write(uuid)
46: .write("_map\"").write(self.getOuterAttrs()).write(">");
47: wh.write("<a href=\"").write(
48: exec.encodeURL("~./zul/html/imagemap-done.dsp"));
49: wh.write("?").write(uuid).write("\" target=\"zk_hfr_\">");
50: wh.write("<img id=\"").write(self.getUuid()).write(
51: "!real\" ismap=\"ismap\"").write(self.getInnerAttrs())
52: .write("/></a>");
53: wh.write("<map name=\"").write(uuid).write("_map\" id=\"")
54: .write(uuid).write("_map\">");
55: wh.writeChildren(self);
56: wh.write("</map></span>");
57: }
58: }
|