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 javax.servlet.jsp.*;
07: import javax.servlet.jsp.tagext.*;
08:
09: import com.sun.comclient.calendar.ICalendar;
10: import com.sun.comclient.calendar.CalendarStore;
11:
12: import com.sun.portal.wireless.taglibs.base.CommandTag;
13:
14: /**
15: * CalCommandTag - common base class for cal commands
16: * Provides access methods for CalContext and Calendar
17: *
18: * @author Robert O'Brien
19: * @version 1.0
20: */
21:
22: public abstract class CalCommandTag extends CommandTag {
23:
24: public CalCommandTag() {
25: super ();
26: }
27:
28: /**
29: * Return the CalContext for a command
30: */
31: public CalContext getContext() throws JspException {
32: try {
33: return CalContext.getContext(pageContext);
34: } catch (Exception e) {
35: throw new JspException("No CalContext found");
36: }
37: }
38:
39: /**
40: * Return the Calendar for a command
41: */
42: public ICalendar getCalendar() throws JspException {
43: ICalendar calendar = getContext().getCalendar();
44:
45: if (calendar == null) {
46: throw new JspException("No Calendar found");
47: }
48:
49: return calendar;
50: }
51:
52: /**
53: * Return the CalStore for a command
54: */
55: public CalendarStore getCalStore() throws JspException {
56: CalendarStore calStore = getContext().getCalStore();
57:
58: if (calStore == null) {
59: throw new JspException("No CalStore found");
60: }
61:
62: return calStore;
63: }
64:
65: }
|