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

abstract class CalendarTag extends TagSupport
A JSP tag to display a calendar view table.
Since:
1.0
Version:
7.2
Author:
Luke
  • Field Details

    • _out

      protected JspWriter _out
    • _startDate

      protected ZonedDateTime _startDate
    • _endDate

      protected ZonedDateTime _endDate
    • _currentDate

      protected ZonedDateTime _currentDate
    • _today

      protected ZonedDateTime _today
    • _tz

      protected ZoneId _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
    • _intervalType

      protected ChronoUnit _intervalType
    • _intervalLength

      protected int _intervalLength
  • Constructor Details

    • CalendarTag

      CalendarTag()
  • Method Details

    • setStartDate

      public abstract void setStartDate(ZonedDateTime 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

      protected abstract String getForwardLabel()
      Returns the label for the scroll forwards link
      Returns:
      the link label
      See Also:
    • getContentClass

      protected String getContentClass(ZonedDateTime dt)
      Calculates the CSS class(es) for the content table cell.
      Parameters:
      dt - the cell date
      Returns:
      a CSS class list
    • getHeaderClass

      protected String getHeaderClass(ZonedDateTime dt)
      Calculates the CSS class(es) for the header table cell.
      Parameters:
      dt - the cell date
      Returns:
      a CSS class list
    • calculateEndDate

      protected void calculateEndDate(ChronoUnit 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:
    • 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
    • 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:
    • 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:
    • 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