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/CalendarTag.java $
024: //$Author: Dan $
025: //$Revision: 9 $
026: //$Modtime: 5/14/04 12:12p $
027: /////////////////////////
028:
029: import com.salmonllc.html.HtmlCalendar;
030: import com.salmonllc.html.HtmlComponent;
031:
032: /**
033: * This tag creates an Html Style
034: */
035:
036: public class CalendarTag extends BaseEmptyTag {
037: public static final int SIZE_LARGE = 1;
038: public static final int SIZE_SMALL = 2;
039:
040: private String _headingBgColor;
041: private String _headingFgColor;
042: private String _weekBgColor;
043: private String _weekFgColor;
044: private String _dayBgColor;
045: private String _dayFgDeemphisis;
046: private String _dayFgNormal;
047: private String _dayFgCurrent;
048: private String _fontFace;
049: private String _fontSize;
050: private String _displaySize;
051: private String _currentMonth;
052: private String _currentYear;
053: private String _width;
054: private String _border;
055: private String _theme;
056:
057: public HtmlComponent createComponent() {
058: HtmlCalendar _calendar = new HtmlCalendar(getName(),
059: getHelper().getController());
060:
061: if (_headingBgColor != null)
062: _calendar.setHeadingBackgroundColor(_headingBgColor);
063: if (_headingFgColor != null)
064: _calendar.setHeadingForegroundColor(_headingFgColor);
065: if (_weekBgColor != null)
066: _calendar.setWeekBackgroundColor(_weekBgColor);
067: if (_weekFgColor != null)
068: _calendar.setWeekForegroundColor(_weekFgColor);
069: if (_dayBgColor != null)
070: _calendar.setDayBackgroundColor(_dayBgColor);
071: if (_dayFgDeemphisis != null)
072: _calendar.setDayForegroundDeemphisisColor(_dayFgDeemphisis);
073: if (_dayFgNormal != null)
074: _calendar.setDayForegroundNormalColor(_dayFgNormal);
075: if (_dayFgCurrent != null)
076: _calendar.setDayForegroundCurrentColor(_dayFgCurrent);
077: if (_fontFace != null)
078: _calendar.setFontFace(_fontFace);
079:
080: if (_displaySize != null
081: && _displaySize.toUpperCase().equals("LARGE")) {
082: _calendar.setDisplaySize(SIZE_LARGE);
083: if (_fontSize != null)
084: _calendar.setFontSizeLarge(BaseTagHelper
085: .stringToInt(_fontSize));
086: }
087:
088: if (_displaySize != null
089: && _displaySize.toUpperCase().equals("SMALL")) {
090: _calendar.setDisplaySize(SIZE_SMALL);
091: if (_fontSize != null)
092: _calendar.setFontSizeSmall(BaseTagHelper
093: .stringToInt(_fontSize));
094: }
095:
096: if (_currentMonth != null)
097: _calendar.setCalendarMonth(BaseTagHelper
098: .stringToInt(_currentMonth));
099: if (_currentYear != null)
100: _calendar.setCalendarYear(BaseTagHelper
101: .stringToInt(_currentYear));
102: if (_width != null) {
103: _calendar.setWidth(BaseTagHelper.stringToInt(_width));
104: if (_width.endsWith("%"))
105: _calendar.setSizeOption(HtmlCalendar.SIZE_PERCENT);
106: else
107: _calendar.setSizeOption(HtmlCalendar.SIZE_PIXELS);
108: }
109: if (_border != null)
110: _calendar.setBorder(BaseTagHelper.stringToInt(_border));
111: if (_theme != null)
112: _calendar.setTheme(_theme);
113:
114: return _calendar;
115: }
116:
117: /**
118: * Returns the Border attribute
119: */
120:
121: public String getBorder() {
122: return _border;
123: }
124:
125: /**
126: * Returns the Current Month attribute
127: */
128:
129: public String getCurrentmonth() {
130: return _currentMonth;
131: }
132:
133: /**
134: * Returns the Current Year attribute
135: */
136:
137: public String getCurrentyear() {
138: return _currentYear;
139: }
140:
141: /**
142: * Returns the DayBackgroundcolor attribute
143: */
144:
145: public String getDaybgcolor() {
146: return _dayBgColor;
147: }
148:
149: /**
150: * Returns the DayForegroundCurrent attribute
151: */
152:
153: public String getDayfgcurrent() {
154: return _dayFgCurrent;
155: }
156:
157: /**
158: * Returns the DayForegroundDeemphasis attribute
159: */
160:
161: public String getDayfgdeemphasis() {
162: return _dayFgDeemphisis;
163: }
164:
165: /**
166: * Returns the DayForegroundNormal attribute
167: */
168:
169: public String getDayfgnormal() {
170: return _dayFgNormal;
171: }
172:
173: /**
174: * Returns the Display Size attribute
175: */
176:
177: public String getdisplaysize() {
178: return _displaySize;
179: }
180:
181: /**
182: * Returns the Font Face attribute
183: */
184:
185: public String getFontface() {
186: return _fontFace;
187: }
188:
189: /**
190: * Returns the Font Size attribute
191: */
192:
193: public String getFontsize() {
194: return _fontSize;
195: }
196:
197: /**
198: * Returns the Headingbackgroundcolor attribute
199: */
200:
201: public String getHeadingbgcolor() {
202: return _headingBgColor;
203: }
204:
205: /**
206: * Returns the HeadingForegroundcolor attribute
207: */
208:
209: public String getHeadingfgcolor() {
210: return _headingFgColor;
211: }
212:
213: /**
214: * Returns the Theme attribute
215: */
216:
217: public String getTheme() {
218: return _theme;
219: }
220:
221: /**
222: * Returns the WeekBackgroundcolor attribute
223: */
224:
225: public String getWeekbgcolor() {
226: return _weekBgColor;
227: }
228:
229: /**
230: * Returns the WeekForegroundcolor attribute
231: */
232:
233: public String getWeekfgcolor() {
234: return _weekFgColor;
235: }
236:
237: /**
238: * Returns the Width attribute
239: */
240:
241: public String getWidth() {
242: return _width;
243: }
244:
245: public void release() {
246: super .release();
247:
248: _headingBgColor = null;
249: _headingFgColor = null;
250: _weekBgColor = null;
251: _weekFgColor = null;
252: _dayBgColor = null;
253: _dayFgDeemphisis = null;
254: _dayFgNormal = null;
255: _dayFgCurrent = null;
256: _fontFace = null;
257: _fontSize = null;
258: _displaySize = null;
259: _currentMonth = null;
260: _currentYear = null;
261: _width = null;
262: _border = null;
263: _theme = null;
264:
265: }
266:
267: /**
268: * Sets the Border attribute
269: */
270:
271: public void setBorder(String val) {
272: _border = val;
273: }
274:
275: /**
276: * Sets the Current Month attribute
277: */
278:
279: public void setCurrentmonth(String val) {
280: _currentMonth = val;
281: }
282:
283: /**
284: * Sets the Current Year attribute
285: */
286:
287: public void setCurrentyear(String val) {
288: _currentYear = val;
289: }
290:
291: /**
292: * Sets the Day Background Color attribute
293: */
294:
295: public void setDaybgcolor(String val) {
296: _dayBgColor = val;
297: }
298:
299: /**
300: * Sets the Day Foreground Current attribute
301: */
302:
303: public void setDayfgcurrentcolor(String val) {
304: _dayFgCurrent = val;
305: }
306:
307: /**
308: * Sets the Day Foreground Deemphasis attribute
309: */
310:
311: public void setDayfgdeemphasiscolor(String val) {
312: _dayFgDeemphisis = val;
313: }
314:
315: /**
316: * Sets the Day Foreground Normal attribute
317: */
318:
319: public void setDayfgnormalcolor(String val) {
320: _dayFgNormal = val;
321: }
322:
323: /**
324: * Sets the Display Size attribute
325: */
326:
327: public void setDisplaysize(String val) {
328: _displaySize = val;
329: }
330:
331: /**
332: * Sets the Font Face attribute
333: */
334:
335: public void setFontface(String val) {
336: _fontFace = val;
337: }
338:
339: /**
340: * Sets the Font Size attribute
341: */
342:
343: public void setFontsize(String val) {
344: _fontSize = val;
345: }
346:
347: /**
348: * Sets the Heading Background Color attribute
349: */
350:
351: public void setHeadingbgcolor(String val) {
352: _headingBgColor = val;
353: }
354:
355: /**
356: * Sets the Heading Foreground Color attribute
357: */
358:
359: public void setHeadingfgcolor(String val) {
360: _headingFgColor = val;
361: }
362:
363: /**
364: * Sets the Theme attribute
365: */
366:
367: public void setTheme(String val) {
368: _theme = val;
369: }
370:
371: /**
372: * Sets the Week Background Color attribute
373: */
374:
375: public void setWeekbgcolor(String val) {
376: _weekBgColor = val;
377: }
378:
379: /**
380: * Sets the Week Foreground Color attribute
381: */
382:
383: public void setWeekfgcolor(String val) {
384: _weekFgColor = val;
385: }
386:
387: /**
388: * Sets the Width attribute
389: */
390:
391: public void setWidth(String val) {
392: _width = val;
393: }
394: }
|