franta-hg@1: /* ================================================================ franta-hg@1: * Cewolf : Chart enabling Web Objects Framework franta-hg@1: * ================================================================ franta-hg@1: * franta-hg@1: * Project Info: http://cewolf.sourceforge.net franta-hg@1: * Project Lead: Guido Laures (guido@laures.de); franta-hg@1: * franta-hg@1: * (C) Copyright 2002, by Guido Laures franta-hg@1: * franta-hg@1: * This library is free software; you can redistribute it and/or modify it under the terms franta-hg@1: * of the GNU Lesser General Public License as published by the Free Software Foundation; franta-hg@1: * either version 2.1 of franta-hg@1: * the License, or (at your option) any later version. franta-hg@1: * franta-hg@1: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; franta-hg@1: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. franta-hg@1: * See the GNU Lesser General Public License for more details. franta-hg@1: * franta-hg@1: * You should have received a copy of the GNU Lesser General Public License along with this franta-hg@1: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, franta-hg@1: * Boston, MA 02111-1307, USA. franta-hg@1: */ franta-hg@1: franta-hg@1: package de.laures.cewolf.taglib.html; franta-hg@1: franta-hg@1: import java.io.IOException; franta-hg@1: import java.io.Serializable; franta-hg@1: import java.io.Writer; franta-hg@1: franta-hg@1: /** franta-hg@1: * HTML img tag. franta-hg@1: * @author Guido Laures franta-hg@1: */ franta-hg@1: public class HTMLImgTag extends AbstractHTMLBaseTag implements Serializable{ franta-hg@1: franta-hg@1: private final static String TAG_NAME = "IMG"; franta-hg@1: franta-hg@1: /** Holds value of property width. */ franta-hg@1: protected int width = UNDEFINED_INT; franta-hg@1: franta-hg@1: /** Holds value of property height. */ franta-hg@1: protected int height = UNDEFINED_INT; franta-hg@1: franta-hg@1: /** Holds value of property src. */ franta-hg@1: protected String src = UNDEFINED_STR; franta-hg@1: franta-hg@1: /** Holds value of property alt. */ franta-hg@1: protected String alt = ""; franta-hg@1: franta-hg@1: /** Holds value of property longDesc. */ franta-hg@1: protected String longDesc = UNDEFINED_STR; franta-hg@1: franta-hg@1: /** Holds value of property useMap. */ franta-hg@1: protected String useMap = UNDEFINED_STR; franta-hg@1: franta-hg@1: /** Holds value of property ismap. */ franta-hg@1: protected String ismap = UNDEFINED_STR; franta-hg@1: franta-hg@1: /** Holds value of property align. */ franta-hg@1: protected String align = UNDEFINED_STR; franta-hg@1: franta-hg@1: /** Holds value of property border. */ franta-hg@1: protected int border = 0; franta-hg@1: franta-hg@1: /** Holds value of property hSpace. */ franta-hg@1: protected int hSpace = UNDEFINED_INT; franta-hg@1: franta-hg@1: /** Holds value of property vSpace. */ franta-hg@1: protected int vSpace = UNDEFINED_INT; franta-hg@1: franta-hg@1: /** franta-hg@1: * Add or not JSESSIONID franta-hg@1: */ franta-hg@1: protected boolean forceSessionId = true; franta-hg@1: franta-hg@1: /** franta-hg@1: * Remove image from Storage after rendering franta-hg@1: */ franta-hg@1: protected boolean removeAfterRender = false; franta-hg@1: franta-hg@1: /* franta-hg@1: public void writeTag(Writer writer) throws IOException { franta-hg@1: writer.write(""); franta-hg@1: } franta-hg@1: **/ franta-hg@1: franta-hg@1: public void writeAttributes(Writer wr){ franta-hg@1: try { franta-hg@1: super.writeAttributes(wr); franta-hg@1: appendAttributeDeclaration(wr, this.border, "BORDER"); franta-hg@1: appendAttributeDeclaration(wr, this.hSpace, "HSPACE"); franta-hg@1: appendAttributeDeclaration(wr, this.height, "HEIGHT"); franta-hg@1: appendAttributeDeclaration(wr, this.vSpace, "VSPACE"); franta-hg@1: appendAttributeDeclaration(wr, this.width, "WIDTH"); franta-hg@1: appendAttributeDeclaration(wr, this.align, "ALIGN"); franta-hg@1: appendAttributeDeclaration(wr, this.alt, "ALT"); franta-hg@1: appendAttributeDeclaration(wr, this.ismap, "ISMAP"); franta-hg@1: appendAttributeDeclaration(wr, this.longDesc, "LONGDESC"); franta-hg@1: appendAttributeDeclaration(wr, this.src, "SRC"); franta-hg@1: appendAttributeDeclaration(wr, this.useMap, "USEMAP"); franta-hg@1: } catch(IOException ioex){ franta-hg@1: ioex.printStackTrace(); franta-hg@1: } franta-hg@1: } franta-hg@1: franta-hg@1: protected void reset(){ franta-hg@1: // width = UNDEFINED_INT; franta-hg@1: // height = UNDEFINED_INT; franta-hg@1: src = UNDEFINED_STR; franta-hg@1: alt = ""; franta-hg@1: longDesc = UNDEFINED_STR; franta-hg@1: useMap = UNDEFINED_STR; franta-hg@1: ismap = UNDEFINED_STR; franta-hg@1: align = UNDEFINED_STR; franta-hg@1: border = 0; franta-hg@1: hSpace = UNDEFINED_INT; franta-hg@1: vSpace = UNDEFINED_INT; franta-hg@1: forceSessionId = true; franta-hg@1: removeAfterRender = false; franta-hg@1: super.reset(); franta-hg@1: } franta-hg@1: franta-hg@1: /** Setter for property width. franta-hg@1: * @param width New value of property width. franta-hg@1: */ franta-hg@1: public void setWidth(int width) { franta-hg@1: this.width = width; franta-hg@1: } franta-hg@1: franta-hg@1: /** Setter for property height. franta-hg@1: * @param height New value of property height. franta-hg@1: */ franta-hg@1: public void setHeight(int height) { franta-hg@1: this.height = height; franta-hg@1: } franta-hg@1: franta-hg@1: /** Setter for property src. franta-hg@1: * @param src New value of property src. franta-hg@1: */ franta-hg@1: public void setSrc(String src) { franta-hg@1: this.src = src; franta-hg@1: } franta-hg@1: franta-hg@1: /** Setter for property alt. franta-hg@1: * @param alt New value of property alt. franta-hg@1: */ franta-hg@1: public void setAlt(String alt) { franta-hg@1: this.alt = alt; franta-hg@1: } franta-hg@1: franta-hg@1: /** Setter for property longDesc. franta-hg@1: * @param longDesc New value of property longDesc. franta-hg@1: */ franta-hg@1: public void setLongdesc(String longDesc) { franta-hg@1: this.longDesc = longDesc; franta-hg@1: } franta-hg@1: franta-hg@1: /** Setter for property useMap. franta-hg@1: * @param useMap New value of property useMap. franta-hg@1: */ franta-hg@1: public void setUsemap(String useMap) { franta-hg@1: this.useMap = useMap; franta-hg@1: } franta-hg@1: franta-hg@1: /** Setter for property ismap. franta-hg@1: * @param ismap New value of property ismap. franta-hg@1: */ franta-hg@1: public void setIsmap(String ismap) { franta-hg@1: this.ismap = ismap; franta-hg@1: } franta-hg@1: franta-hg@1: /** Setter for property align. franta-hg@1: * @param align New value of property align. franta-hg@1: */ franta-hg@1: public void setAlign(String align) { franta-hg@1: this.align = align; franta-hg@1: } franta-hg@1: franta-hg@1: /** Setter for property border. franta-hg@1: * @param border New value of property border. franta-hg@1: */ franta-hg@1: public void setBorder(int border) { franta-hg@1: this.border = border; franta-hg@1: } franta-hg@1: franta-hg@1: /** Setter for property hSpace. franta-hg@1: * @param hSpace New value of property hSpace. franta-hg@1: */ franta-hg@1: public void setHspace(int hSpace) { franta-hg@1: this.hSpace = hSpace; franta-hg@1: } franta-hg@1: franta-hg@1: /** Setter for property vSpace. franta-hg@1: * @param vSpace New value of property vSpace. franta-hg@1: */ franta-hg@1: public void setVspace(int vSpace) { franta-hg@1: this.vSpace = vSpace; franta-hg@1: } franta-hg@1: franta-hg@1: protected String getTagName() { franta-hg@1: return TAG_NAME; franta-hg@1: } franta-hg@1: franta-hg@1: protected boolean hasBody() { franta-hg@1: return false; franta-hg@1: } franta-hg@1: franta-hg@1: protected boolean wellFormed() { franta-hg@1: return false; franta-hg@1: } franta-hg@1: franta-hg@1: franta-hg@1: /** franta-hg@1: * @return Returns the forceSessionId. franta-hg@1: */ franta-hg@1: public boolean isForceSessionId() { franta-hg@1: return forceSessionId; franta-hg@1: } franta-hg@1: franta-hg@1: /** franta-hg@1: * @param forceSessionId The forceSessionId to set. franta-hg@1: */ franta-hg@1: public void setForceSessionId(boolean forceSessionId) { franta-hg@1: this.forceSessionId = forceSessionId; franta-hg@1: } franta-hg@1: franta-hg@1: /** franta-hg@1: * @return Returns the removeAfterRender. franta-hg@1: */ franta-hg@1: public boolean isRemoveAfterRender() { franta-hg@1: return removeAfterRender; franta-hg@1: } franta-hg@1: franta-hg@1: /** franta-hg@1: * @param removeAfterRender The removeAfterRender to set. franta-hg@1: */ franta-hg@1: public void setRemoveAfterRender(boolean removeAfterRender) { franta-hg@1: this.removeAfterRender = removeAfterRender; franta-hg@1: } franta-hg@1: }