001: /* ================================================================
002: * Cewolf : Chart enabling Web Objects Framework
003: * ================================================================
004: *
005: * Project Info: http://cewolf.sourceforge.net
006: * Project Lead: Guido Laures (guido@laures.de);
007: *
008: * (C) Copyright 2002, by Guido Laures
009: *
010: * This library is free software; you can redistribute it and/or modify it under the terms
011: * of the GNU Lesser General Public License as published by the Free Software Foundation;
012: * either version 2.1 of
013: * the License, or (at your option) any later version.
014: *
015: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
016: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
017: * See the GNU Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public License along with this
020: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
021: * Boston, MA 02111-1307, USA.
022: */
023:
024: package de.laures.cewolf.taglib.html;
025:
026: import java.io.IOException;
027: import java.io.Serializable;
028: import java.io.Writer;
029:
030: /**
031: * HTML img tag.
032: * @author Guido Laures
033: */
034: public class HTMLImgTag extends AbstractHTMLBaseTag implements
035: Serializable {
036:
037: private final static String TAG_NAME = "IMG";
038:
039: /** Holds value of property width. */
040: protected int width = UNDEFINED_INT;
041:
042: /** Holds value of property height. */
043: protected int height = UNDEFINED_INT;
044:
045: /** Holds value of property src. */
046: protected String src = UNDEFINED_STR;
047:
048: /** Holds value of property alt. */
049: protected String alt = "";
050:
051: /** Holds value of property longDesc. */
052: protected String longDesc = UNDEFINED_STR;
053:
054: /** Holds value of property useMap. */
055: protected String useMap = UNDEFINED_STR;
056:
057: /** Holds value of property ismap. */
058: protected String ismap = UNDEFINED_STR;
059:
060: /** Holds value of property align. */
061: protected String align = UNDEFINED_STR;
062:
063: /** Holds value of property border. */
064: protected int border = 0;
065:
066: /** Holds value of property hSpace. */
067: protected int hSpace = UNDEFINED_INT;
068:
069: /** Holds value of property vSpace. */
070: protected int vSpace = UNDEFINED_INT;
071:
072: /**
073: * Add or not JSESSIONID
074: */
075: protected boolean forceSessionId = true;
076:
077: /**
078: * Remove image from Storage after rendering
079: */
080: protected boolean removeAfterRender = false;
081:
082: /*
083: public void writeTag(Writer writer) throws IOException {
084: writer.write("<img ");
085: writeAttributes(writer);
086: writer.write("/>");
087: }
088: **/
089:
090: public void writeAttributes(Writer wr) {
091: try {
092: super .writeAttributes(wr);
093: appendAttributeDeclaration(wr, this .border, "BORDER");
094: appendAttributeDeclaration(wr, this .hSpace, "HSPACE");
095: appendAttributeDeclaration(wr, this .height, "HEIGHT");
096: appendAttributeDeclaration(wr, this .vSpace, "VSPACE");
097: appendAttributeDeclaration(wr, this .width, "WIDTH");
098: appendAttributeDeclaration(wr, this .align, "ALIGN");
099: appendAttributeDeclaration(wr, this .alt, "ALT");
100: appendAttributeDeclaration(wr, this .ismap, "ISMAP");
101: appendAttributeDeclaration(wr, this .longDesc, "LONGDESC");
102: appendAttributeDeclaration(wr, this .src, "SRC");
103: appendAttributeDeclaration(wr, this .useMap, "USEMAP");
104: } catch (IOException ioex) {
105: ioex.printStackTrace();
106: }
107: }
108:
109: protected void reset() {
110: // width = UNDEFINED_INT;
111: // height = UNDEFINED_INT;
112: src = UNDEFINED_STR;
113: alt = "";
114: longDesc = UNDEFINED_STR;
115: useMap = UNDEFINED_STR;
116: ismap = UNDEFINED_STR;
117: align = UNDEFINED_STR;
118: border = 0;
119: hSpace = UNDEFINED_INT;
120: vSpace = UNDEFINED_INT;
121: forceSessionId = true;
122: removeAfterRender = false;
123: super .reset();
124: }
125:
126: /** Setter for property width.
127: * @param width New value of property width.
128: */
129: public void setWidth(int width) {
130: this .width = width;
131: }
132:
133: /** Setter for property height.
134: * @param height New value of property height.
135: */
136: public void setHeight(int height) {
137: this .height = height;
138: }
139:
140: /** Setter for property src.
141: * @param src New value of property src.
142: */
143: public void setSrc(String src) {
144: this .src = src;
145: }
146:
147: /** Setter for property alt.
148: * @param alt New value of property alt.
149: */
150: public void setAlt(String alt) {
151: this .alt = alt;
152: }
153:
154: /** Setter for property longDesc.
155: * @param longDesc New value of property longDesc.
156: */
157: public void setLongdesc(String longDesc) {
158: this .longDesc = longDesc;
159: }
160:
161: /** Setter for property useMap.
162: * @param useMap New value of property useMap.
163: */
164: public void setUsemap(String useMap) {
165: this .useMap = useMap;
166: }
167:
168: /** Setter for property ismap.
169: * @param ismap New value of property ismap.
170: */
171: public void setIsmap(String ismap) {
172: this .ismap = ismap;
173: }
174:
175: /** Setter for property align.
176: * @param align New value of property align.
177: */
178: public void setAlign(String align) {
179: this .align = align;
180: }
181:
182: /** Setter for property border.
183: * @param border New value of property border.
184: */
185: public void setBorder(int border) {
186: this .border = border;
187: }
188:
189: /** Setter for property hSpace.
190: * @param hSpace New value of property hSpace.
191: */
192: public void setHspace(int hSpace) {
193: this .hSpace = hSpace;
194: }
195:
196: /** Setter for property vSpace.
197: * @param vSpace New value of property vSpace.
198: */
199: public void setVspace(int vSpace) {
200: this .vSpace = vSpace;
201: }
202:
203: protected String getTagName() {
204: return TAG_NAME;
205: }
206:
207: protected boolean hasBody() {
208: return false;
209: }
210:
211: protected boolean wellFormed() {
212: return false;
213: }
214:
215: /**
216: * @return Returns the forceSessionId.
217: */
218: public boolean isForceSessionId() {
219: return forceSessionId;
220: }
221:
222: /**
223: * @param forceSessionId The forceSessionId to set.
224: */
225: public void setForceSessionId(boolean forceSessionId) {
226: this .forceSessionId = forceSessionId;
227: }
228:
229: /**
230: * @return Returns the removeAfterRender.
231: */
232: public boolean isRemoveAfterRender() {
233: return removeAfterRender;
234: }
235:
236: /**
237: * @param removeAfterRender The removeAfterRender to set.
238: */
239: public void setRemoveAfterRender(boolean removeAfterRender) {
240: this.removeAfterRender = removeAfterRender;
241: }
242: }
|