1 /*
2 * Angkor Web Framework
3 *
4 * Distributable under LGPL license.
5 * See terms of license at gnu.org.
6 */
7
8 package com.tirsen.angkor.widget;
9
10 import com.tirsen.angkor.RenderContext;
11 import com.tirsen.angkor.Component;
12
13 import java.io.IOException;
14
15 /***
16 * @author $Author: tirsen $
17 * @version $Revision: 1.6 $
18 * <BR>
19 * $Id: Image.java,v 1.6 2002/10/13 19:59:23 tirsen Exp $
20 */
21 public class Image extends Component
22 {
23 private String sourceURL;
24 private ImageMap imageMap;
25 private String alt;
26
27 public void setSourceURL(String sourceURL)
28 {
29 this.sourceURL = sourceURL;
30 }
31
32 public String getSourceURL()
33 {
34 return sourceURL;
35 }
36
37 public void setAlt(String alt)
38 {
39 this.alt = alt;
40 }
41
42 public String getAlt()
43 {
44 return alt;
45 }
46
47 public void render(RenderContext context) throws IOException
48 {
49 if (isVisible())
50 {
51 System.out.println("getImageMap() = " + getImageMap());
52 if (getImageMap() != null) imageMap.render(context);
53 String imageMap = getImageMap() == null ? "" : " usemap=\"#" + getImageMap().uniqueId(context) + "\"";
54 String alt = getAlt() == null ? "" : " alt=\"" + getAlt() + "\"";
55 String idAttr = " id=\"" + uniqueId(context) + "\"";
56 context.emptyTag("IMG SRC=\"" + getSourceURL() + "\" border=\"0\"" + imageMap + alt + idAttr);
57 }
58 }
59
60 public void parse(RenderContext context)
61 {
62 super.parse(context);
63 if (getImageMap() != null) imageMap.parse(context);
64 }
65
66 public ImageMap getImageMap()
67 {
68 return imageMap;
69 }
70
71 public void setImageMap(ImageMap imageMap)
72 {
73 if (this.imageMap != null) this.imageMap.setContainer(null);
74 this.imageMap = imageMap;
75 this.imageMap.setContainer(this);
76 }
77 }
This page was automatically generated by Maven