001: //** Copyright Statement ***************************************************
002: // Licensed Material - Property of Salmon LLC
003: // (C) Copyright Salmon LLC. 1999 - All Rights Reserved
004: // For more information go to www.salmonllc.com
005: //
006: // *************************************************************************
007: // DISCLAIMER:
008: // The following code has been created by Salmon LLC. The code is provided
009: // 'AS IS' , without warranty of any kind unless covered in another agreement
010: // between your corporation and Salmon LLC. Salmon LLC shall not be liable
011: // for any damages arising out of your use of this, even if they have been
012: // advised of the possibility of such damages.
013: //** End Copyright Statement ***************************************************
014: package com.salmonllc.wml.tags;
015:
016: import com.salmonllc.html.HtmlComponent;
017: import com.salmonllc.jsp.tags.BaseEmptyTag;
018: import com.salmonllc.jsp.tags.BaseTagHelper;
019: import com.salmonllc.wml.WmlImage;
020:
021: /**
022: * This is a tag used to place images on a wml page
023: */
024:
025: public class ImageTag extends BaseEmptyTag {
026: private String _src;
027: private String _localsrc;
028: private String _alt;
029: private String _align;
030: private String _width;
031: private String _height;
032: private String _vspace;
033: private String _hspace;
034: private String _dataSource;
035: private String _class;
036:
037: /**
038: * This method creates the Wml Image used by the tag.
039: */
040: public HtmlComponent createComponent() {
041:
042: WmlImage imgComp = new WmlImage(getName(), _src, getHelper()
043: .getController());
044:
045: if (_align != null)
046: imgComp.setAlign(_align);
047:
048: if (_alt != null)
049: imgComp.setAlt(_alt);
050:
051: if (_height != null)
052: imgComp.setHeight(BaseTagHelper.stringToInt(_height));
053:
054: if (_vspace != null)
055: imgComp
056: .setVerticalSpace(BaseTagHelper
057: .stringToInt(_vspace));
058:
059: if (_hspace != null)
060: imgComp.setHorizontalSpace(BaseTagHelper
061: .stringToInt(_hspace));
062:
063: if (_width != null)
064: imgComp.setWidth(BaseTagHelper.stringToInt(_width));
065:
066: if (_dataSource != null)
067: imgComp.setDataSource(_dataSource);
068:
069: if (_localsrc != null)
070: imgComp.setLocalSrc(_localsrc);
071:
072: if (getClassname() != null)
073: imgComp.setClassName(getClassname());
074:
075: return imgComp;
076:
077: }
078:
079: /**
080: * This method gets the alignment attribute for the tag
081: */
082: public String getAlign() {
083: return _align;
084: }
085:
086: /**
087: * This method gets the alt attribute for the tag
088: */
089:
090: public String getAlt() {
091: return _alt;
092: }
093:
094: /**
095: * This method gets the bordet attribute for the tag
096: */
097:
098: public String getLocalsrc() {
099: return _localsrc;
100: }
101:
102: /**
103: * Get the Data Source the component should be bound to
104: */
105:
106: public String getDatasource() {
107: return _dataSource;
108: }
109:
110: /**
111: * This method gets the height attribute for the tag
112: */
113:
114: public String getHeight() {
115: return _height;
116: }
117:
118: /**
119: * This method gets the source attribute for the tag
120: */
121: public String getSrc() {
122: return _src;
123: }
124:
125: /**
126: * Use this method to get the classname attribute
127: */
128: public String getClassname() {
129: return _class;
130: }
131:
132: /**
133: * This method gets the vspace attribute for the tag
134: */
135:
136: public String getVspace() {
137: return _vspace;
138: }
139:
140: /**
141: * This method gets the hspace attribute for the tag
142: */
143:
144: public String getHspace() {
145: return _hspace;
146: }
147:
148: /**
149: * This method gets the width attribute for the tag
150: */
151:
152: public String getWidth() {
153: return _width;
154: }
155:
156: /**
157: * This method is part of the JSP spec
158: */
159:
160: public void release() {
161: super .release();
162: _src = null;
163: _alt = null;
164: _align = null;
165: _localsrc = null;
166: _width = null;
167: _height = null;
168: _vspace = null;
169: _hspace = null;
170: _class = null;
171: _dataSource = null;
172: }
173:
174: /**
175: * This method sets the align attribute for the tag
176: */
177:
178: public void setAlign(String newAlign) {
179: _align = newAlign;
180: }
181:
182: /**
183: * This method sets the alt attribute for the tag
184: */
185:
186: public void setAlt(String newAlt) {
187: _alt = newAlt;
188: }
189:
190: /**
191: * This method sets the localsrc attribute for the tag
192: */
193:
194: public void setLocalsrc(String localsrc) {
195: _localsrc = localsrc;
196: }
197:
198: /**
199: * Set the Data Source the component should be bound to
200: */
201:
202: public void setDatasource(String val) {
203: _dataSource = val;
204: }
205:
206: /**
207: * This method sets the height attribute for the tag
208: */
209:
210: public void setHeight(String newHeight) {
211: _height = newHeight;
212: }
213:
214: /**
215: * This method sets the source attribute for the tag
216: */
217:
218: public void setSrc(String newSrc) {
219: _src = newSrc;
220: }
221:
222: /**
223: * This method sets the hspace attribute for the tag
224: */
225:
226: public void setHspace(String hspace) {
227: _hspace = hspace;
228: }
229:
230: /**
231: * This method sets the vertical space attribute for the tag
232: */
233:
234: public void setVspace(String newVspace) {
235: _vspace = newVspace;
236: }
237:
238: /**
239: * This method sets the width attribute for the tag
240: */
241:
242: public void setWidth(String newWidth) {
243: _width = newWidth;
244: }
245:
246: /**
247: * This method sets the classname attribute.
248: */
249: public void setClassname(String className) {
250: _class = className;
251: }
252:
253: }
|