001: //** Copyright Statement ***************************************************
002: //The Salmon Open Framework for Internet Applications (SOFIA)
003: // Copyright (C) 1999 - 2002, Salmon LLC
004: //
005: // This program is free software; you can redistribute it and/or
006: // modify it under the terms of the GNU General Public License version 2
007: // as published by the Free Software Foundation;
008: //
009: // This program is distributed in the hope that it will be useful,
010: // but WITHOUT ANY WARRANTY; without even the implied warranty of
011: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: // GNU General Public License for more details.
013: //
014: // You should have received a copy of the GNU General Public License
015: // along with this program; if not, write to the Free Software
016: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017: //
018: // For more information please visit http://www.salmonllc.com
019: //** End Copyright Statement ***************************************************
020: package com.salmonllc.jsp.tags;
021:
022: /////////////////////////
023: //$Archive: /SOFIA/SourceCode/com/salmonllc/jsp/tags/TextTag.java $
024: //$Author: Fred $
025: //$Revision: 23 $
026: //$Modtime: 12/23/02 2:45p $
027: /////////////////////////
028:
029: import com.salmonllc.html.*;
030: import com.salmonllc.util.Util;
031:
032: /**
033: * This tag creates an HTMLText component
034: */
035:
036: public class TextTag extends BaseEmptyTag {
037: private String _font;
038: private String _text;
039: private String _class;
040: private String _theme;
041: private String _dataSource;
042: private String _fixhtml;
043: private String _onmouseout;
044: private String _onmouseover;
045: private String _textlocalekey;
046: private String _displayformatlocalekey;
047: private String _displayformat;
048:
049: /**
050: * Creates the HtmlText component used by the tag
051: */
052:
053: public HtmlComponent createComponent() {
054: HtmlText ht = null;
055: if (!BaseTagHelper.isEmpty(_class)) {
056: HtmlStyle newStyle = new HtmlStyle(_class, null, null,
057: getHelper().getController());
058: if (!BaseTagHelper.isEmpty(_theme)) {
059: ht = new HtmlText(getName(), _text, newStyle,
060: getHelper().getController(), _theme);
061: ht.setVisible(BaseTagHelper.stringToBoolean(
062: getVisible(), true));
063: if (_dataSource != null)
064: ht.setDataSource(_dataSource);
065:
066: // setting whether to fixhtml characters
067: if (_fixhtml != null)
068: ht.setFixSpecialHtmlCharacters(BaseTagHelper
069: .stringToBoolean(getFixhtml(), true));
070: if (_onmouseout != null)
071: ht.setOnMouseOut(getOnmouseout());
072: if (_onmouseover != null)
073: ht.setOnMouseOver(getOnmouseover());
074: if (_displayformatlocalekey != null)
075: ht
076: .setDisplayFormatLocaleKey(_displayformatlocalekey);
077: if (_textlocalekey != null)
078: ht.setTextLocaleKey(_textlocalekey);
079: if (_displayformat != null)
080: ht.setDisplayFormat(_displayformat);
081:
082: return ht;
083: } else {
084: ht = new HtmlText(getName(), _text, newStyle,
085: getHelper().getController());
086: ht.setVisible(BaseTagHelper.stringToBoolean(
087: getVisible(), true));
088: if (_dataSource != null)
089: ht.setDataSource(_dataSource);
090:
091: // setting whether to fixhtml characters
092: if (_fixhtml != null)
093: ht.setFixSpecialHtmlCharacters(BaseTagHelper
094: .stringToBoolean(getFixhtml(), true));
095: if (_onmouseout != null)
096: ht.setOnMouseOut(getOnmouseout());
097: if (_onmouseover != null)
098: ht.setOnMouseOver(getOnmouseover());
099: if (_displayformatlocalekey != null)
100: ht
101: .setDisplayFormatLocaleKey(_displayformatlocalekey);
102: if (_displayformat != null)
103: ht.setDisplayFormat(_displayformat);
104: if (_textlocalekey != null)
105: ht.setTextLocaleKey(_textlocalekey);
106: if (_displayformat != null)
107: ht.setDisplayFormat(_displayformat);
108:
109: return ht;
110: }
111: } else {
112: if (!BaseTagHelper.isEmpty(_theme)) {
113: ht = new HtmlText(getName(), _text, _font, getHelper()
114: .getController(), _theme);
115: ht.setVisible(BaseTagHelper.stringToBoolean(
116: getVisible(), true));
117: if (_dataSource != null)
118: ht.setDataSource(_dataSource);
119:
120: // setting whether to fixhtml characters
121: if (_fixhtml != null)
122: ht.setFixSpecialHtmlCharacters(BaseTagHelper
123: .stringToBoolean(getFixhtml(), true));
124: if (_onmouseout != null)
125: ht.setOnMouseOut(getOnmouseout());
126: if (_onmouseover != null)
127: ht.setOnMouseOver(getOnmouseover());
128: if (_displayformatlocalekey != null)
129: ht
130: .setDisplayFormatLocaleKey(_displayformatlocalekey);
131: if (_textlocalekey != null)
132: ht.setTextLocaleKey(_textlocalekey);
133: if (_displayformat != null)
134: ht.setDisplayFormat(_displayformat);
135:
136: return ht;
137: } else {
138: ht = new HtmlText(getName(), _text, _font, getHelper()
139: .getController());
140: ht.setVisible(BaseTagHelper.stringToBoolean(
141: getVisible(), true));
142: if (_dataSource != null)
143: ht.setDataSource(_dataSource);
144:
145: // setting whether to fixhtml characters
146: if (_fixhtml != null)
147: ht.setFixSpecialHtmlCharacters(BaseTagHelper
148: .stringToBoolean(getFixhtml(), true));
149: if (_onmouseout != null)
150: ht.setOnMouseOut(getOnmouseout());
151: if (_onmouseover != null)
152: ht.setOnMouseOver(getOnmouseover());
153: if (_displayformatlocalekey != null)
154: ht
155: .setDisplayFormatLocaleKey(_displayformatlocalekey);
156: if (_textlocalekey != null)
157: ht.setTextLocaleKey(_textlocalekey);
158: if (_displayformat != null)
159: ht.setDisplayFormat(_displayformat);
160:
161: return ht;
162: }
163: }
164: }
165:
166: /**
167: * Gets the onmouseout property for the tag
168: */
169:
170: public java.lang.String getOnmouseout() {
171: return _onmouseout;
172: }
173:
174: /**
175: * Gets the onmouseover property for the tag
176: */
177: public java.lang.String getOnmouseover() {
178: return _onmouseover;
179: }
180:
181: /**
182: * Get the Data Source the component should be bound to
183: */
184:
185: public String getDatasource() {
186: return _dataSource;
187: }
188:
189: /**
190: * Gets the font property for the tag
191: */
192:
193: public String getFont() {
194: return _font;
195: }
196:
197: /**
198: * Gets the text property for the tag
199: */
200:
201: public String getText() {
202: return _text;
203: }
204:
205: /**
206: * Gets the theme property for the tag
207: */
208:
209: public String getTheme() {
210: return _theme;
211: }
212:
213: public void release() {
214: super .release();
215: _font = null;
216: _text = null;
217: _class = null;
218: _theme = null;
219: _textlocalekey = null;
220: _displayformatlocalekey = null;
221: _displayformat = null;
222:
223: }
224:
225: /**
226: * Specify whether special html characters (<,>,&,; etc..) should be converted to Html Escape Sequences before being generated.
227: */
228: public void setFixhtml(java.lang.String new_fixhtml) {
229: _fixhtml = new_fixhtml;
230: }
231:
232: /**
233: * Use this method to set the javascript that will be executed when the mouse passes over out of all the components
234: */
235: public void setOnmouseout(java.lang.String new_onmouseout) {
236: _onmouseout = new_onmouseout;
237: }
238:
239: /**
240: * Use this method to set the javascript that will be executed when the mouse passes over any component in the link
241: */
242: public void setOnmouseover(java.lang.String new_onmouseover) {
243: _onmouseover = new_onmouseover;
244: }
245:
246: /**
247: * Set the Data Source the component should be bound to
248: */
249:
250: public void setDatasource(String newValue) {
251: _dataSource = newValue;
252: }
253:
254: /**
255: * Sets the font property for the tag
256: */
257:
258: public void setFont(String font) {
259: _font = font;
260: }
261:
262: /**
263: * Sets the text property for the tag
264: */
265:
266: public void setText(String newValue) {
267: // fc:12/23/02 added the replacement of " to ' to allow for JSP Engines which have problems with sinqle quotes in tags. e.g. Silverstream
268: _text = Util.replaceString(newValue, """, "'", 1, -1);
269: }
270:
271: /**
272: * Sets the theme property for the tag
273: */
274:
275: public void setTheme(String newValue) {
276: _theme = newValue;
277: }
278:
279: /**
280: * Gets the fixhtml property for the tag
281: */
282:
283: public java.lang.String getFixhtml() {
284: return _fixhtml;
285: }
286:
287: /**
288: * Sets the class property for the tag
289: */
290:
291: public void setClassname(String val) {
292: _class = val;
293: }
294:
295: /**
296: * Sets the textlocalekey property for the tag
297: */
298:
299: public void setTextlocalekey(String newValue) {
300: _textlocalekey = newValue;
301: }
302:
303: /**
304: * Sets the displayformatlocalekey property for the tag
305: */
306:
307: public void setDisplayformatlocalekey(String newValue) {
308: _displayformatlocalekey = newValue;
309: }
310:
311: /**
312: * Sets the displayformat property for the tag
313: */
314:
315: public void setDisplayformat(String newValue) {
316: _displayformat = newValue;
317: }
318: }
|