CLRA 0.1.2

com.clra.web
Class MonthViewSelectorTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--com.clra.web.MonthViewSelectorTag
All Implemented Interfaces:
Serializable, javax.servlet.jsp.tagext.Tag

public class MonthViewSelectorTag
extends javax.servlet.jsp.tagext.TagSupport

Stuff.

Version:
$Revision: 1.2 $ $Date: 2002/02/18 18:06:37 $
Author:
Rick Hall
See Also:
Serialized Form

Field Summary
protected static org.apache.struts.util.MessageResources messages
          The message resources for this package
protected  String page
          The context-relative URI
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
MonthViewSelectorTag()
           
 
Method Summary
protected  String createLink(int month, javax.servlet.http.HttpServletRequest request)
          Creates a link from the currentMonth request
protected  String createLink(int month, String contextPath, String page)
          Create a link from the specified page
protected  String createQueryString(int month, Hashtable queryParams)
          Form a query string from current parameter and the specified month
protected  void doEndLink()
           
 int doEndTag()
          Render the end of the selector
protected  void doMonthLeadingSeparationText(int unused)
          Writes the text that separates month links
protected  void doMonthLink(int month)
          Write a month link
protected  void doMonthLinks()
          Writes a year's worth of month links
protected  void doMonthText(int month)
          Writes a Calendar-based month (0-11) as user-friendly text
protected  void doMonthTrailingSeparationText(int unused)
          Writes the text that separates month links
protected  void doStartLink(int month)
           
 int doStartTag()
          Render the beginning of the selector
 Integer getCurrentMonth()
          Return the currently selected month (0 - 11, or null)
 String getPage()
          Return the context-relative URI
static Integer monthFromContext(javax.servlet.jsp.PageContext context)
          A utility which determines what month should be currently selected based on the page context.
 void release()
          Release any acquired resources.
static void resetMonthInContexts(javax.servlet.jsp.PageContext context, Integer month)
          A utility which resets request and session attributes so that only the session attribute AN_MONTH holds the currently selected month.
 void setCurrentMonth(Integer currentMonth)
          Set the currently selected month (0 - 11, or null)
 void setPage(String page)
          Set the context-relative URI
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messages

protected static org.apache.struts.util.MessageResources messages
The message resources for this package

page

protected String page
The context-relative URI
Constructor Detail

MonthViewSelectorTag

public MonthViewSelectorTag()
Method Detail

getPage

public String getPage()
Return the context-relative URI

setPage

public void setPage(String page)
Set the context-relative URI

getCurrentMonth

public Integer getCurrentMonth()
Return the currently selected month (0 - 11, or null)

setCurrentMonth

public void setCurrentMonth(Integer currentMonth)
                     throws javax.servlet.jsp.JspException
Set the currently selected month (0 - 11, or null)

monthFromContext

public static Integer monthFromContext(javax.servlet.jsp.PageContext context)
A utility which determines what month should be currently selected based on the page context. The algorithm is:
  1. Check for a request parameter named IEventList.AN_MONTH. If found, and it is a valid Integer in the range 0 - 11, use it.
  2. Check for a request attribute named IEventList.AN_MONTH. If found, and it is valid, use it.
  3. Check for a session attribute named IEventList.AN_MONTH. If found, and it is valid, use it.
  4. If a valid month hasn't been determined yet, return the current calendar month

resetMonthInContexts

public static void resetMonthInContexts(javax.servlet.jsp.PageContext context,
                                        Integer month)
A utility which resets request and session attributes so that only the session attribute AN_MONTH holds the currently selected month. The algorithm is:
  1. Check for a request attribute named IEventList.AN_MONTH. If found, remove it.
  2. Check for a session attribute named IEventList.AN_MONTH. If found, reset to the specified value; otherwise create and set it.
If the specified month is invalid (not between 0 and 11, inclusive), no action is taken and an error is logged.

createQueryString

protected String createQueryString(int month,
                                   Hashtable queryParams)
Form a query string from current parameter and the specified month

createLink

protected String createLink(int month,
                            String contextPath,
                            String page)
                     throws javax.servlet.jsp.JspException
Create a link from the specified page

createLink

protected String createLink(int month,
                            javax.servlet.http.HttpServletRequest request)
Creates a link from the currentMonth request

doStartLink

protected void doStartLink(int month)
                    throws javax.servlet.jsp.JspException

doEndLink

protected void doEndLink()
                  throws javax.servlet.jsp.JspException

doMonthText

protected void doMonthText(int month)
                    throws javax.servlet.jsp.JspException
Writes a Calendar-based month (0-11) as user-friendly text

doMonthLeadingSeparationText

protected void doMonthLeadingSeparationText(int unused)
                                     throws javax.servlet.jsp.JspException
Writes the text that separates month links

doMonthTrailingSeparationText

protected void doMonthTrailingSeparationText(int unused)
                                      throws javax.servlet.jsp.JspException
Writes the text that separates month links

doMonthLink

protected void doMonthLink(int month)
                    throws javax.servlet.jsp.JspException
Write a month link

doMonthLinks

protected void doMonthLinks()
                     throws javax.servlet.jsp.JspException
Writes a year's worth of month links

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Render the beginning of the selector
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Render the end of the selector
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport

release

public void release()
Release any acquired resources.
Overrides:
release in class javax.servlet.jsp.tagext.TagSupport

CLRA 0.1.2