Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.clra.web
Class MonthViewSelectorTag  view MonthViewSelectorTag download MonthViewSelectorTag.java

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended bycom.clra.web.MonthViewSelectorTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

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

Stuff.

Version:
$Revision: 1.3 $ $Date: 2003/02/26 03:38:46 $

Field Summary
private static java.lang.String base
           
private  java.lang.Integer currentMonth
          The currently selected month (0 - 11)
protected static org.apache.struts.util.MessageResources messages
          The message resources for this package
protected  java.lang.String page
          The context-relative URI
private static org.apache.log4j.Category theLog
           
 
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
MonthViewSelectorTag()
           
 
Method Summary
protected  java.lang.String createLink(int month, javax.servlet.http.HttpServletRequest request)
          Creates a link from the currentMonth request
protected  java.lang.String createLink(int month, java.lang.String contextPath, java.lang.String page)
          Create a link from the specified page
protected  java.lang.String createQueryString(int month, java.util.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
 java.lang.Integer getCurrentMonth()
          Return the currently selected month (0 - 11, or null)
 java.lang.String getPage()
          Return the context-relative URI
static java.lang.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, java.lang.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(java.lang.Integer currentMonth)
          Set the currently selected month (0 - 11, or null)
 void setPage(java.lang.String page)
          Set the context-relative URI
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, 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

base

private static final java.lang.String base

theLog

private static final org.apache.log4j.Category theLog

messages

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


page

protected java.lang.String page
The context-relative URI


currentMonth

private java.lang.Integer currentMonth
The currently selected month (0 - 11)

Constructor Detail

MonthViewSelectorTag

public MonthViewSelectorTag()
Method Detail

getPage

public java.lang.String getPage()
Return the context-relative URI


setPage

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


getCurrentMonth

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


setCurrentMonth

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


monthFromContext

public static java.lang.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,
                                        java.lang.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 java.lang.String createQueryString(int month,
                                             java.util.Hashtable queryParams)
Form a query string from current parameter and the specified month


createLink

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


createLink

protected java.lang.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


doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Render the end of the selector


release

public void release()
Release any acquired resources.