/*
* Angkor Web Framework
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package com.tirsen.angkor.widget;
import com.tirsen.angkor.RenderContext;
import com.tirsen.angkor.Component;
import java.io.IOException;
/**
* @author $Author: tirsen $
* @version $Revision: 1.6 $
* <BR>
* $Id: Image.java,v 1.6 2002/10/13 19:59:23 tirsen Exp $
public class Image extends Component
{
private String sourceURL;
private ImageMap imageMap;
private String alt;
public void setSourceURL(String sourceURL)
this.sourceURL = sourceURL;
}
public String getSourceURL()
return sourceURL;
public void setAlt(String alt)
this.alt = alt;
public String getAlt()
return alt;
public void render(RenderContext context) throws IOException
if (isVisible())
System.out.println("getImageMap() = " + getImageMap());
if (getImageMap() != null) imageMap.render(context);
String imageMap = getImageMap() == null ? "" : " usemap=\"#" + getImageMap().uniqueId(context) + "\"";
String alt = getAlt() == null ? "" : " alt=\"" + getAlt() + "\"";
String idAttr = " id=\"" + uniqueId(context) + "\"";
context.emptyTag("IMG SRC=\"" + getSourceURL() + "\" border=\"0\"" + imageMap + alt + idAttr);
public void parse(RenderContext context)
super.parse(context);
if (getImageMap() != null) imageMap.parse(context);
public ImageMap getImageMap()
return imageMap;
public void setImageMap(ImageMap imageMap)
if (this.imageMap != null) this.imageMap.setContainer(null);
this.imageMap = imageMap;
this.imageMap.setContainer(this);