View Javadoc

1   /***
2    * Calendar Tag Library
3    * Copyright (C) 2005 James Smith
4    * 
5    * This library is free software; you can redistribute it and/or
6    * modify it under the terms of the GNU Lesser General Public
7    * License as published by the Free Software Foundation; either
8    * version 2.1 of the License, or (at your option) any later version.
9    *
10   * This library is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   * Lesser General Public License for more details.
14   * 
15   * You should have received a copy of the GNU Lesser General Public
16   * License along with this library; if not, write to the Free Software
17   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18   * You should be able to download a copy of the LGPL from
19   * www.opensource.org/licenses/lgpl-license.php
20   */
21  package org.calendartag.decorator;
22  
23  import javax.servlet.jsp.PageContext;
24  import java.util.Calendar;
25  
26  /***
27   * The Calendar Decorator defines the interface for decoraing a rendered calendar.  Provide the
28   * fully qualifed classpath of an implementation as the <code>decorator</code> attribute.
29   * @since Aug 28, 2004
30   * @see org.calendartag.tags.CalendarTag org.calendartag.decorators.DefaultCalendarDecorator
31   * @author James Smith
32   */
33  public interface CalendarDecorator {
34  
35      /***
36       * Called when a day cell is being rendered. 
37       * @param isOddMonth true if the month is odd
38       * @param isSelectedDay true if the day is selected
39       * @return the string representing the css class to display.
40       */
41      public String getDayStyleClass(boolean isOddMonth, boolean isSelectedDay);
42      
43      /***
44       * Called before any of the calendar is displayed.  This is an appropriate place to determine which
45       * information is required from the database.  It has access to startCalendar and endCalendar since both
46       * setEnd and setStart have already been called.
47       */
48      public void initializeCalendar();
49      
50      /***
51       * Gets the calendar's title.
52       * @return the calendar's title as HTML
53       */
54      public String getCalendarTitle();
55  
56      /***
57       * Gets the day of the week's abreviation for each column.
58       * @param day the day as an integer, 1-7 monday-friday
59       * @return the day of the week's abreviation as HTML
60       */
61      public String getWeekdayTitle(int day);
62  
63      /***
64       * Gets the contents of an empty day.
65       * @return the contents of an empty day as HTML
66       */
67      public String getEmptyDay();
68  
69      /***
70       * Gets the contents of an unempty day.  <code>setCalendar</code> will have previously
71       * been called, this object will contain the information required to know which day it is.
72       * @return the contents of an unempty day as HTML
73       * @param  url the url that can be used to set the current day to focus
74       */
75      public String getDay(String url);
76  
77      /***
78       * Defines the <code>pageContext</code> which should bea useful elsewhere.
79       * @param pageContext the pageContext of the <code>HttpServletRequest</code>
80       */
81      public void setPageContext(PageContext pageContext);
82  
83      /***
84       * Defines a <code>Calendar</code> object that will always reflect the current day being rendered.
85       * @param calendar a <code>Calendar</code> object
86       */
87      public void setCalendar(Calendar calendar);
88  
89      /***
90       * Gets the previous link as HTML
91       * @return the previous link
92       * @param url the url that the previous link should point to
93       */
94      public String getPreviousLink(String url);
95  
96      /***
97       * Gets the next link as HTML
98       * @return the next link
99       * @param url the url that the next link should point to
100      */
101     public String getNextLink(String url);
102 
103     /***
104      * Sets the start date of the calendar's range
105      * @param start the start date
106      */
107     void setStart(Calendar start);
108 
109     /*** Sets the end date of the calendar's range
110      * @param end the end date
111      */
112     void setEnd(Calendar end);
113 
114 }
115