Class CalendarTag
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
org.deltava.taglib.calendar.CalendarTag
- All Implemented Interfaces:
Serializable
,IterationTag
,JspTag
,Tag
- Direct Known Subclasses:
MonthlyCalendarTag
,WeeklyCalendarTag
A JSP tag to display a calendar view table.
- Since:
- 1.0
- Version:
- 7.2
- Author:
- Luke
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected String
protected ZonedDateTime
protected XMLRenderer
protected String
protected ZonedDateTime
protected final Collection
<CalendarEntry> protected int
protected ChronoUnit
protected JspWriter
protected boolean
protected ZonedDateTime
protected XMLRenderer
protected String
protected String
protected ZonedDateTime
protected String
protected ZoneId
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
calculateEndDate
(ChronoUnit intervalType, int amount) Calculcates the end date based on the start date and a particular interval amount.int
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
Starts the Calendar tag by setting the current date to render.protected abstract String
Returns the label for the scroll backwards link.protected String
Calculates the CSS class(es) for the content table cell.(package private) Collection
<CalendarEntry> Returns all Calendar entries for the currently rendered Date, from midnight to 11:59PM.protected abstract String
Returns the label for the scroll forwards linkprotected String
Calculates the CSS class(es) for the header table cell.void
release()
Releases the tag's state variables.void
setBorder
(int border) Sets the BORDER value for this table.void
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
Sets the request attribute name for the current date.void
setDayBarClass
(String cName) Sets the CSS class name for the view table day bar.final void
setEntries
(Collection<CalendarEntry> entries) Sets the entries to display in this calendar view table.void
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.abstract void
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
-
Field Details
-
_out
-
_startDate
-
_endDate
-
_currentDate
-
_today
-
_tz
-
_entries
-
_tableID
-
_tableClass
-
_topBarClass
-
_dayBarClass
-
_contentClass
-
_border
protected int _border -
_showDaysOfWeek
protected boolean _showDaysOfWeek -
_table
-
_day
-
_intervalType
-
_intervalLength
protected int _intervalLength
-
-
Constructor Details
-
CalendarTag
CalendarTag()
-
-
Method Details
-
setStartDate
Sets the start date of the data range.- Parameters:
dt
- the start date/time
-
getBackLabel
Returns the label for the scroll backwards link.- Returns:
- the link label
- See Also:
-
getForwardLabel
Returns the label for the scroll forwards link- Returns:
- the link label
- See Also:
-
getContentClass
Calculates the CSS class(es) for the content table cell.- Parameters:
dt
- the cell date- Returns:
- a CSS class list
-
getHeaderClass
Calculates the CSS class(es) for the header table cell.- Parameters:
dt
- the cell date- Returns:
- a CSS class list
-
calculateEndDate
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:
-
setDate
Sets the request attribute name for the current date.- Parameters:
attrName
- the request attribute name
-
setTableClass
Sets the CSS class name for the view table.- Parameters:
cName
- the CSS class name
-
setTableID
-
setTopBarClass
Sets the CSS class name for the view table title bar.- Parameters:
cName
- the CSS class name
-
setDayBarClass
Sets the CSS class name for the view table day bar.- Parameters:
cName
- the CSS class name
-
setContentClass
Sets the CSS class name for the view table content bar.- Parameters:
cName
- the CSS class name
-
setScrollClass
Sets the CSS class name for the forwad/backward scroll links.- Parameters:
cName
- the CSS class name
-
setCmd
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
-
setBorder
public void setBorder(int border) Sets the BORDER value for this table.- Parameters:
border
- the border width attribute value
-
setEntries
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:
-
setPageContext
Sets the page context for the tag, and sets the user's time zone.- Specified by:
setPageContext
in interfaceTag
- Overrides:
setPageContext
in classTagSupport
- 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:
-
doAfterBody
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 interfaceIterationTag
- Overrides:
doAfterBody
in classTagSupport
- Returns:
- EVAL_BODY_AGAIN if current date is before endDate, otherwise SKIP_BODY
- Throws:
JspException
- never
-
doStartTag
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 interfaceTag
- Overrides:
doStartTag
in classTagSupport
- Returns:
- TagSupport.EVAL_BODY_INCLUDE always
- Throws:
JspException
- never
-
doEndTag
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 interfaceTag
- Overrides:
doEndTag
in classTagSupport
- 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 interfaceTag
- Overrides:
release
in classTagSupport
-