org.deltava.taglib.format
Class DateFormatTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.deltava.taglib.format.DateFormatTag
All Implemented Interfaces:
Serializable, IterationTag, JspTag, Tag

public class DateFormatTag
extends TagSupport

A JSP tag to support the display of formatted date/time values.

Since:
1.0
Version:
1.0
Author:
Luke
See Also:
Serialized Form

Field Summary
 
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
DateFormatTag()
           
 
Method Summary
 int doEndTag()
          Formats the date/time and writes it to the JSP output writer.
 int doStartTag()
          Mashes the date and time together in a date/time object.
 void release()
          Releases this tag's state variables.
 void setClassName(String cName)
          Updates the CSS class for this formatted date/time.
 void setD(String pattern)
          Updates the date format pattern.
 void setDate(Date d)
          Sets the date/time to display.
 void setDefault(String defaultText)
          Updates the text to display if the date is null.
 void setFmt(String dtFmt)
          Sets what components of the date/time to display.
 void setPageContext(PageContext ctxt)
          Updates this tag's page context and loads the user object from the request.
 void setShowZone(boolean showZone)
          Overrides whether the time zone should be displayed.
 void setT(String pattern)
          Updates the time format pattern.
 void setTz(TZInfo tz)
          Overrides the time zone used to display the date/time with.
 void setTzName(String tzName)
          Overrides the time zone used to display the date/time with.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, 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
 

Constructor Detail

DateFormatTag

public DateFormatTag()
Method Detail

setPageContext

public final void setPageContext(PageContext ctxt)
Updates this tag's page context and loads the user object from the request.

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

setClassName

public void setClassName(String cName)
Updates the CSS class for this formatted date/time. This will automatically enclose the output in a <SPAN> tag.

Parameters:
cName - the class Name(s)

setD

public void setD(String pattern)
Updates the date format pattern.

Parameters:
pattern - the pattern string
Throws:
IllegalArgumentException - if SimpleDateFormat cannot interpret the pattern
See Also:
SimpleDateFormat.applyPattern(String)

setDefault

public void setDefault(String defaultText)
Updates the text to display if the date is null.

Parameters:
defaultText - the text to display

setT

public void setT(String pattern)
Updates the time format pattern.

Parameters:
pattern - the pattern string
Throws:
IllegalArgumentException - if SimpleDateFormat cannot interpret the pattern
See Also:
SimpleDateFormat.applyPattern(String)

setFmt

public void setFmt(String dtFmt)
Sets what components of the date/time to display.

Parameters:
dtFmt - "dt" to show date/time, "d" for date only, "t" for time only

setDate

public void setDate(Date d)
Sets the date/time to display.

Parameters:
d - the date/time
Throws:
NullPointerException - if d is null

setTz

public void setTz(TZInfo tz)
Overrides the time zone used to display the date/time with.

Parameters:
tz - the time zone

setTzName

public void setTzName(String tzName)
Overrides the time zone used to display the date/time with.

Parameters:
tzName - the time zone name

setShowZone

public void setShowZone(boolean showZone)
Overrides whether the time zone should be displayed.

Parameters:
showZone - TRUE if the time zone should be displayed, otherwise FALSE
See Also:
DateTime.showZone(boolean)

release

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

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

doStartTag

public int doStartTag()
               throws JspException
Mashes the date and time together in a date/time object.

Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class TagSupport
Returns:
TagSupport.SKIP_BODY
Throws:
JspException - if an error occurs

doEndTag

public int doEndTag()
             throws JspException
Formats the date/time and writes it to the JSP output writer.

Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class TagSupport
Returns:
TagSupport.EVAL_PAGE
Throws:
JspException - if an error occurs


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