1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/html/HTMLImgTag.java Sat Feb 28 21:31:02 2009 +0100
1.3 @@ -0,0 +1,242 @@
1.4 +/* ================================================================
1.5 + * Cewolf : Chart enabling Web Objects Framework
1.6 + * ================================================================
1.7 + *
1.8 + * Project Info: http://cewolf.sourceforge.net
1.9 + * Project Lead: Guido Laures (guido@laures.de);
1.10 + *
1.11 + * (C) Copyright 2002, by Guido Laures
1.12 + *
1.13 + * This library is free software; you can redistribute it and/or modify it under the terms
1.14 + * of the GNU Lesser General Public License as published by the Free Software Foundation;
1.15 + * either version 2.1 of
1.16 + * the License, or (at your option) any later version.
1.17 + *
1.18 + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
1.19 + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1.20 + * See the GNU Lesser General Public License for more details.
1.21 + *
1.22 + * You should have received a copy of the GNU Lesser General Public License along with this
1.23 + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
1.24 + * Boston, MA 02111-1307, USA.
1.25 + */
1.26 +
1.27 +package de.laures.cewolf.taglib.html;
1.28 +
1.29 +import java.io.IOException;
1.30 +import java.io.Serializable;
1.31 +import java.io.Writer;
1.32 +
1.33 +/**
1.34 + * HTML img tag.
1.35 + * @author Guido Laures
1.36 + */
1.37 +public class HTMLImgTag extends AbstractHTMLBaseTag implements Serializable{
1.38 +
1.39 + private final static String TAG_NAME = "IMG";
1.40 +
1.41 + /** Holds value of property width. */
1.42 + protected int width = UNDEFINED_INT;
1.43 +
1.44 + /** Holds value of property height. */
1.45 + protected int height = UNDEFINED_INT;
1.46 +
1.47 + /** Holds value of property src. */
1.48 + protected String src = UNDEFINED_STR;
1.49 +
1.50 + /** Holds value of property alt. */
1.51 + protected String alt = "";
1.52 +
1.53 + /** Holds value of property longDesc. */
1.54 + protected String longDesc = UNDEFINED_STR;
1.55 +
1.56 + /** Holds value of property useMap. */
1.57 + protected String useMap = UNDEFINED_STR;
1.58 +
1.59 + /** Holds value of property ismap. */
1.60 + protected String ismap = UNDEFINED_STR;
1.61 +
1.62 + /** Holds value of property align. */
1.63 + protected String align = UNDEFINED_STR;
1.64 +
1.65 + /** Holds value of property border. */
1.66 + protected int border = 0;
1.67 +
1.68 + /** Holds value of property hSpace. */
1.69 + protected int hSpace = UNDEFINED_INT;
1.70 +
1.71 + /** Holds value of property vSpace. */
1.72 + protected int vSpace = UNDEFINED_INT;
1.73 +
1.74 + /**
1.75 + * Add or not JSESSIONID
1.76 + */
1.77 + protected boolean forceSessionId = true;
1.78 +
1.79 + /**
1.80 + * Remove image from Storage after rendering
1.81 + */
1.82 + protected boolean removeAfterRender = false;
1.83 +
1.84 + /*
1.85 + public void writeTag(Writer writer) throws IOException {
1.86 + writer.write("<img ");
1.87 + writeAttributes(writer);
1.88 + writer.write("/>");
1.89 + }
1.90 + **/
1.91 +
1.92 + public void writeAttributes(Writer wr){
1.93 + try {
1.94 + super.writeAttributes(wr);
1.95 + appendAttributeDeclaration(wr, this.border, "BORDER");
1.96 + appendAttributeDeclaration(wr, this.hSpace, "HSPACE");
1.97 + appendAttributeDeclaration(wr, this.height, "HEIGHT");
1.98 + appendAttributeDeclaration(wr, this.vSpace, "VSPACE");
1.99 + appendAttributeDeclaration(wr, this.width, "WIDTH");
1.100 + appendAttributeDeclaration(wr, this.align, "ALIGN");
1.101 + appendAttributeDeclaration(wr, this.alt, "ALT");
1.102 + appendAttributeDeclaration(wr, this.ismap, "ISMAP");
1.103 + appendAttributeDeclaration(wr, this.longDesc, "LONGDESC");
1.104 + appendAttributeDeclaration(wr, this.src, "SRC");
1.105 + appendAttributeDeclaration(wr, this.useMap, "USEMAP");
1.106 + } catch(IOException ioex){
1.107 + ioex.printStackTrace();
1.108 + }
1.109 + }
1.110 +
1.111 + protected void reset(){
1.112 + // width = UNDEFINED_INT;
1.113 + // height = UNDEFINED_INT;
1.114 + src = UNDEFINED_STR;
1.115 + alt = "";
1.116 + longDesc = UNDEFINED_STR;
1.117 + useMap = UNDEFINED_STR;
1.118 + ismap = UNDEFINED_STR;
1.119 + align = UNDEFINED_STR;
1.120 + border = 0;
1.121 + hSpace = UNDEFINED_INT;
1.122 + vSpace = UNDEFINED_INT;
1.123 + forceSessionId = true;
1.124 + removeAfterRender = false;
1.125 + super.reset();
1.126 + }
1.127 +
1.128 + /** Setter for property width.
1.129 + * @param width New value of property width.
1.130 + */
1.131 + public void setWidth(int width) {
1.132 + this.width = width;
1.133 + }
1.134 +
1.135 + /** Setter for property height.
1.136 + * @param height New value of property height.
1.137 + */
1.138 + public void setHeight(int height) {
1.139 + this.height = height;
1.140 + }
1.141 +
1.142 + /** Setter for property src.
1.143 + * @param src New value of property src.
1.144 + */
1.145 + public void setSrc(String src) {
1.146 + this.src = src;
1.147 + }
1.148 +
1.149 + /** Setter for property alt.
1.150 + * @param alt New value of property alt.
1.151 + */
1.152 + public void setAlt(String alt) {
1.153 + this.alt = alt;
1.154 + }
1.155 +
1.156 + /** Setter for property longDesc.
1.157 + * @param longDesc New value of property longDesc.
1.158 + */
1.159 + public void setLongdesc(String longDesc) {
1.160 + this.longDesc = longDesc;
1.161 + }
1.162 +
1.163 + /** Setter for property useMap.
1.164 + * @param useMap New value of property useMap.
1.165 + */
1.166 + public void setUsemap(String useMap) {
1.167 + this.useMap = useMap;
1.168 + }
1.169 +
1.170 + /** Setter for property ismap.
1.171 + * @param ismap New value of property ismap.
1.172 + */
1.173 + public void setIsmap(String ismap) {
1.174 + this.ismap = ismap;
1.175 + }
1.176 +
1.177 + /** Setter for property align.
1.178 + * @param align New value of property align.
1.179 + */
1.180 + public void setAlign(String align) {
1.181 + this.align = align;
1.182 + }
1.183 +
1.184 + /** Setter for property border.
1.185 + * @param border New value of property border.
1.186 + */
1.187 + public void setBorder(int border) {
1.188 + this.border = border;
1.189 + }
1.190 +
1.191 + /** Setter for property hSpace.
1.192 + * @param hSpace New value of property hSpace.
1.193 + */
1.194 + public void setHspace(int hSpace) {
1.195 + this.hSpace = hSpace;
1.196 + }
1.197 +
1.198 + /** Setter for property vSpace.
1.199 + * @param vSpace New value of property vSpace.
1.200 + */
1.201 + public void setVspace(int vSpace) {
1.202 + this.vSpace = vSpace;
1.203 + }
1.204 +
1.205 + protected String getTagName() {
1.206 + return TAG_NAME;
1.207 + }
1.208 +
1.209 + protected boolean hasBody() {
1.210 + return false;
1.211 + }
1.212 +
1.213 + protected boolean wellFormed() {
1.214 + return false;
1.215 + }
1.216 +
1.217 +
1.218 + /**
1.219 + * @return Returns the forceSessionId.
1.220 + */
1.221 + public boolean isForceSessionId() {
1.222 + return forceSessionId;
1.223 + }
1.224 +
1.225 + /**
1.226 + * @param forceSessionId The forceSessionId to set.
1.227 + */
1.228 + public void setForceSessionId(boolean forceSessionId) {
1.229 + this.forceSessionId = forceSessionId;
1.230 + }
1.231 +
1.232 + /**
1.233 + * @return Returns the removeAfterRender.
1.234 + */
1.235 + public boolean isRemoveAfterRender() {
1.236 + return removeAfterRender;
1.237 + }
1.238 +
1.239 + /**
1.240 + * @param removeAfterRender The removeAfterRender to set.
1.241 + */
1.242 + public void setRemoveAfterRender(boolean removeAfterRender) {
1.243 + this.removeAfterRender = removeAfterRender;
1.244 + }
1.245 +}