1 /* ================================================================
2 * Cewolf : Chart enabling Web Objects Framework
3 * ================================================================
5 * Project Info: http://cewolf.sourceforge.net
6 * Project Lead: Guido Laures (guido@laures.de);
8 * (C) Copyright 2002, by Guido Laures
10 * This library is free software; you can redistribute it and/or modify it under the terms
11 * of the GNU Lesser General Public License as published by the Free Software Foundation;
12 * either version 2.1 of
13 * the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
16 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 * See the GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License along with this
20 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
21 * Boston, MA 02111-1307, USA.
24 package de.laures.cewolf.taglib.html;
26 import java.io.IOException;
27 import java.io.Serializable;
28 import java.io.Writer;
32 * @author Guido Laures
34 public class HTMLImgTag extends AbstractHTMLBaseTag implements Serializable{
36 private final static String TAG_NAME = "IMG";
38 /** Holds value of property width. */
39 protected int width = UNDEFINED_INT;
41 /** Holds value of property height. */
42 protected int height = UNDEFINED_INT;
44 /** Holds value of property src. */
45 protected String src = UNDEFINED_STR;
47 /** Holds value of property alt. */
48 protected String alt = "";
50 /** Holds value of property longDesc. */
51 protected String longDesc = UNDEFINED_STR;
53 /** Holds value of property useMap. */
54 protected String useMap = UNDEFINED_STR;
56 /** Holds value of property ismap. */
57 protected String ismap = UNDEFINED_STR;
59 /** Holds value of property align. */
60 protected String align = UNDEFINED_STR;
62 /** Holds value of property border. */
63 protected int border = 0;
65 /** Holds value of property hSpace. */
66 protected int hSpace = UNDEFINED_INT;
68 /** Holds value of property vSpace. */
69 protected int vSpace = UNDEFINED_INT;
72 * Add or not JSESSIONID
74 protected boolean forceSessionId = true;
77 * Remove image from Storage after rendering
79 protected boolean removeAfterRender = false;
82 public void writeTag(Writer writer) throws IOException {
83 writer.write("<img ");
84 writeAttributes(writer);
89 public void writeAttributes(Writer wr){
91 super.writeAttributes(wr);
92 appendAttributeDeclaration(wr, this.border, "BORDER");
93 appendAttributeDeclaration(wr, this.hSpace, "HSPACE");
94 appendAttributeDeclaration(wr, this.height, "HEIGHT");
95 appendAttributeDeclaration(wr, this.vSpace, "VSPACE");
96 appendAttributeDeclaration(wr, this.width, "WIDTH");
97 appendAttributeDeclaration(wr, this.align, "ALIGN");
98 appendAttributeDeclaration(wr, this.alt, "ALT");
99 appendAttributeDeclaration(wr, this.ismap, "ISMAP");
100 appendAttributeDeclaration(wr, this.longDesc, "LONGDESC");
101 appendAttributeDeclaration(wr, this.src, "SRC");
102 appendAttributeDeclaration(wr, this.useMap, "USEMAP");
103 } catch(IOException ioex){
104 ioex.printStackTrace();
108 protected void reset(){
109 // width = UNDEFINED_INT;
110 // height = UNDEFINED_INT;
113 longDesc = UNDEFINED_STR;
114 useMap = UNDEFINED_STR;
115 ismap = UNDEFINED_STR;
116 align = UNDEFINED_STR;
118 hSpace = UNDEFINED_INT;
119 vSpace = UNDEFINED_INT;
120 forceSessionId = true;
121 removeAfterRender = false;
125 /** Setter for property width.
126 * @param width New value of property width.
128 public void setWidth(int width) {
132 /** Setter for property height.
133 * @param height New value of property height.
135 public void setHeight(int height) {
136 this.height = height;
139 /** Setter for property src.
140 * @param src New value of property src.
142 public void setSrc(String src) {
146 /** Setter for property alt.
147 * @param alt New value of property alt.
149 public void setAlt(String alt) {
153 /** Setter for property longDesc.
154 * @param longDesc New value of property longDesc.
156 public void setLongdesc(String longDesc) {
157 this.longDesc = longDesc;
160 /** Setter for property useMap.
161 * @param useMap New value of property useMap.
163 public void setUsemap(String useMap) {
164 this.useMap = useMap;
167 /** Setter for property ismap.
168 * @param ismap New value of property ismap.
170 public void setIsmap(String ismap) {
174 /** Setter for property align.
175 * @param align New value of property align.
177 public void setAlign(String align) {
181 /** Setter for property border.
182 * @param border New value of property border.
184 public void setBorder(int border) {
185 this.border = border;
188 /** Setter for property hSpace.
189 * @param hSpace New value of property hSpace.
191 public void setHspace(int hSpace) {
192 this.hSpace = hSpace;
195 /** Setter for property vSpace.
196 * @param vSpace New value of property vSpace.
198 public void setVspace(int vSpace) {
199 this.vSpace = vSpace;
202 protected String getTagName() {
206 protected boolean hasBody() {
210 protected boolean wellFormed() {
216 * @return Returns the forceSessionId.
218 public boolean isForceSessionId() {
219 return forceSessionId;
223 * @param forceSessionId The forceSessionId to set.
225 public void setForceSessionId(boolean forceSessionId) {
226 this.forceSessionId = forceSessionId;
230 * @return Returns the removeAfterRender.
232 public boolean isRemoveAfterRender() {
233 return removeAfterRender;
237 * @param removeAfterRender The removeAfterRender to set.
239 public void setRemoveAfterRender(boolean removeAfterRender) {
240 this.removeAfterRender = removeAfterRender;