01: // Copyright %G% Sun Microsystems, Inc. All Rights Reserved.
02: // "%W% %E% Sun Microsystems"
03:
04: package com.sun.portal.wireless.taglibs.cal;
05:
06: import java.util.TimeZone;
07:
08: import javax.servlet.jsp.*;
09: import javax.servlet.jsp.tagext.*;
10:
11: import com.sun.comclient.calendar.DateTime;
12: import com.sun.portal.wireless.taglibs.base.BeanTag;
13:
14: /**
15: * DateTimeTag - tag that represents an JCAPI DateTime bean
16: *
17: * @author Sathya kavacheri
18: * @version 1.0
19: * @see com.sun.portal.calendar.DateTime
20: */
21:
22: public class DateTimeTag extends BeanTag {
23:
24: /**
25: * the Default constructor
26: */
27: public DateTimeTag() {
28: super ();
29: }
30:
31: /**
32: * Find the bean
33: *
34: * BeanTag.findBean() searches for a collection if no
35: * "name" is specified. There is no such thing as a DateTime
36: * collection, so we must override this method, and NOT search
37: * for a collection.
38: *
39: * @return the found bean
40: */
41: public Object findBean() throws Exception {
42: Object bean;
43:
44: if (name != null) {
45: return pageContext.getAttribute(name);
46: }
47:
48: bean = newBean();
49:
50: if (id != null) {
51: pageContext.setAttribute(id, bean);
52: }
53:
54: return bean;
55: }
56:
57: /**
58: * Create a new DateTime bean object
59: *
60: * @return the DateTime object
61: */
62: public Object newBean() throws Exception {
63: CalContext calContext = CalContext.getContext(pageContext);
64: TimeZone tz = calContext.getTimeZone();
65:
66: return new DateTime(tz);
67: }
68: }
|