org.deltava.taglib.calendar
Class CalendarTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.deltava.taglib.calendar.CalendarTag
All Implemented Interfaces:
Serializable, IterationTag, JspTag, Tag
Direct Known Subclasses:
MonthlyCalendarTag, WeeklyCalendarTag

abstract class CalendarTag
extends TagSupport
implements IterationTag

A JSP tag to display a calendar view table.

Since:
1.0
Version:
3.1
Author:
Luke

Field Summary
protected  int _border
           
protected  int _cellPad
           
protected  int _cellSpace
           
protected  String _contentClass
           
protected  Calendar _currentDate
           
protected  XMLRenderer _day
           
protected  String _dayBarClass
           
protected  Date _endDate
           
protected  Collection<CalendarEntry> _entries
           
protected  int _intervalLength
           
protected  int _intervalType
           
protected  JspWriter _out
           
protected  boolean _showDaysOfWeek
           
protected  Date _startDate
           
protected  XMLRenderer _table
           
protected  String _tableClass
           
protected  String _tableID
           
protected  String _topBarClass
           
protected  TZInfo _tz
           
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
CalendarTag()
           
 
Method Summary
protected  void calculateEndDate(int intervalType, int amount)
          Calculcates the end date based on the start date and a particular interval amount.
 int doAfterBody()
          Determines if we have further days to render in the calendar.
 int doEndTag()
          Ends the Calendar tag by adding the scroll forward/backward link row.
 int doStartTag()
          Starts the Calendar tag by setting the current date to render.
protected abstract  String getBackLabel()
          Returns the label for the scroll backwards link.
(package private)  Collection<CalendarEntry> getCurrentEntries()
          Returns all Calendar entries for the currently rendered Date, from midnight to 11:59PM.
protected abstract  String getForwardLabel()
          Returns the label for the scroll forwards link
 void release()
          Releases the tag's state variables.
 void setBorder(int border)
          Sets the BORDER value for this table.
 void setCmd(String cmdName)
          Sets the command name to use when scrolling the view.
 void setContentClass(String cName)
          Sets the CSS class name for the view table content bar.
 void setDate(String attrName)
          Sets the request attribute name for the current date.
 void setDayBarClass(String cName)
          Sets the CSS class name for the view table day bar.
 void setEntries(Collection<CalendarEntry> entries)
          Sets the entries to display in this calendar view table.
 void setPad(int cPadding)
          Sets the CELLPADDING value for this table.
 void setPageContext(PageContext ctx)
          Sets the page context for the tag, and sets the user's time zone.
 void setScrollClass(String cName)
          Sets the CSS class name for the forwad/backward scroll links.
 void setScrollTags(boolean showScroll)
          Sets whether to display the forward/backward scroll tags.
 void setShowDaysOfWeek(boolean showDOW)
          Sets whether the days of the week should be displayed below the title bar.
 void setSpace(int cSpacing)
          Sets the CELLSPACING value for this table.
abstract  void setStartDate(Date dt)
          Sets the start date of the data range.
 void setTableClass(String cName)
          Sets the CSS class name for the view table.
 void setTableID(String id)
          Sets the CSS ID for the view table.
 void setTopBarClass(String cName)
          Sets the CSS class name for the view table title bar.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Field Detail

_out

protected JspWriter _out

_startDate

protected Date _startDate

_endDate

protected Date _endDate

_currentDate

protected Calendar _currentDate

_tz

protected TZInfo _tz

_entries

protected final Collection<CalendarEntry> _entries

_tableID

protected String _tableID

_tableClass

protected String _tableClass

_topBarClass

protected String _topBarClass

_dayBarClass

protected String _dayBarClass

_contentClass

protected String _contentClass

_border

protected int _border

_showDaysOfWeek

protected boolean _showDaysOfWeek

_table

protected XMLRenderer _table

_day

protected XMLRenderer _day

_cellPad

protected int _cellPad

_cellSpace

protected int _cellSpace

_intervalType

protected int _intervalType

_intervalLength

protected int _intervalLength
Constructor Detail

CalendarTag

CalendarTag()
Method Detail

setStartDate

public abstract void setStartDate(Date dt)
Sets the start date of the data range.

Parameters:
dt - the start date/time

getBackLabel

protected abstract String getBackLabel()
Returns the label for the scroll backwards link.

Returns:
the link label
See Also:
getForwardLabel()

getForwardLabel

protected abstract String getForwardLabel()
Returns the label for the scroll forwards link

Returns:
the link label
See Also:
getBackLabel()

calculateEndDate

protected void calculateEndDate(int intervalType,
                                int amount)
Calculcates the end date based on the start date and a particular interval amount. This must be called by a subclass for the forward/backward links to work properly.

Parameters:
intervalType - the interval type (use Calendar constants)
amount - the size of the interval
See Also:
Calendar

setDate

public void setDate(String attrName)
Sets the request attribute name for the current date.

Parameters:
attrName - the request attribute name

setTableClass

public void setTableClass(String cName)
Sets the CSS class name for the view table.

Parameters:
cName - the CSS class name

setTableID

public void setTableID(String id)
Sets the CSS ID for the view table.

Parameters:
id - the ID

setTopBarClass

public void setTopBarClass(String cName)
Sets the CSS class name for the view table title bar.

Parameters:
cName - the CSS class name

setDayBarClass

public void setDayBarClass(String cName)
Sets the CSS class name for the view table day bar.

Parameters:
cName - the CSS class name

setContentClass

public void setContentClass(String cName)
Sets the CSS class name for the view table content bar.

Parameters:
cName - the CSS class name

setScrollClass

public void setScrollClass(String cName)
Sets the CSS class name for the forwad/backward scroll links.

Parameters:
cName - the CSS class name

setCmd

public void setCmd(String cmdName)
Sets the command name to use when scrolling the view.

Parameters:
cmdName - the command name

setShowDaysOfWeek

public void setShowDaysOfWeek(boolean showDOW)
Sets whether the days of the week should be displayed below the title bar.

Parameters:
showDOW - TRUE if the days of the week should be displayed, otherwise FALSE

setScrollTags

public void setScrollTags(boolean showScroll)
Sets whether to display the forward/backward scroll tags.

Parameters:
showScroll - TRUE if forward/back links are displayed, otherwise FALSE

setSpace

public void setSpace(int cSpacing)
Sets the CELLSPACING value for this table.

Parameters:
cSpacing - the cellspacing attribute value.

setPad

public void setPad(int cPadding)
Sets the CELLPADDING value for this table.

Parameters:
cPadding - the cellpadding attribute value.

setBorder

public void setBorder(int border)
Sets the BORDER value for this table.

Parameters:
border - the border width attribute value

setEntries

public final void setEntries(Collection<CalendarEntry> entries)
Sets the entries to display in this calendar view table. Entries outside the table's date range will not be added.

Parameters:
entries - a Collection of CalendarEntry beans
See Also:
getCurrentEntries()

setPageContext

public void setPageContext(PageContext ctx)
Sets the page context for the tag, and sets the user's time zone.

Specified by:
setPageContext in interface Tag
Overrides:
setPageContext in class TagSupport
Parameters:
ctx - the JSP page context

getCurrentEntries

Collection<CalendarEntry> getCurrentEntries()
Returns all Calendar entries for the currently rendered Date, from midnight to 11:59PM.

Returns:
a Collection of CalendarEntry beans
See Also:
setEntries(Collection)

doAfterBody

public int doAfterBody()
                throws JspException
Determines if we have further days to render in the calendar. Subclasses are responsible for opening and closing the table cells.

Specified by:
doAfterBody in interface IterationTag
Overrides:
doAfterBody in class TagSupport
Returns:
EVAL_BODY_AGAIN if current date is before endDate, otherwise SKIP_BODY
Throws:
JspException - never

doStartTag

public int doStartTag()
               throws JspException
Starts the Calendar tag by setting the current date to render. Subclasses are responsible for opening and closing the table cells.

Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class TagSupport
Returns:
TagSupport.EVAL_BODY_INCLUDE always
Throws:
JspException - never

doEndTag

public int doEndTag()
             throws JspException
Ends the Calendar tag by adding the scroll forward/backward link row. Subclasses are responsible for closing the current table row and closing the table.

Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class TagSupport
Returns:
EVAL_PAGE always
Throws:
JspException - if an I/O error occurs

release

public void release()
Releases the tag's state variables.

Specified by:
release in interface Tag
Overrides:
release in class TagSupport


Copyright © 2004-2009 Global Virtual Airlines Group. All Rights Reserved.