You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by gl...@locus.apache.org on 2000/11/06 02:19:07 UTC

cvs commit: jakarta-taglibs/datetime/src/org/apache/taglibs/datetime FormatTag.java

glenn       00/11/05 17:19:07

  Modified:    datetime/src/org/apache/taglibs/datetime FormatTag.java
  Log:
  Cleanup for release
  
  Revision  Changes    Path
  1.2       +31 -16    jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/FormatTag.java
  
  Index: FormatTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/FormatTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FormatTag.java	2000/09/29 16:13:56	1.1
  +++ FormatTag.java	2000/11/06 01:19:07	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/FormatTag.java,v 1.1 2000/09/29 16:13:56 glenn Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/09/29 16:13:56 $
  + * $Header: /home/cvs/jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/FormatTag.java,v 1.2 2000/11/06 01:19:07 glenn Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/11/06 01:19:07 $
    *
    * ====================================================================
    *
  @@ -71,13 +71,17 @@
   /**
    * JSP Tag <b>format</b>, used to format a Date for display.
    * <p>
  - * The Date as a long in ms is obtained from the body of the tag.
  + * The Date as a long in milliseconds is obtained from the body of the tag.
    * <p>
  - * Uses the optional attribute <b>pattern</b> as the pattern
  - * to use when formatting the Date.
  + * Uses the optional attribute <b>pattern</b> as the time pattern
  + * string to use when formatting the Date.
    * <p>
  + * The optional attribute <b>timezone</b> can be set to the id of
  + * a timezone script varaible so that the Date if adjusted for 
  + * that timezone.
  + * <p>
    * If the optional attribute <b>locale</b> is true, the Date
  - * are formatted for the clients locale if known.
  + * is formatted for the clients locale if known.
    * <p>
    * JSP Tag Lib Descriptor
    * <p><pre>
  @@ -107,17 +111,21 @@
   
   public class FormatTag extends BodyTagSupport
   {
  +    // Optional attribute, use users locale if known when formatting date
       private Locale locale = null;
  +    // Optional attribute, time pattern string to use when formatting date
       private String pattern = null;
  +    // Optional attribute, timezone script variable id to use when formatting date
       private TimeZone timezone = null;
  +    // The date after being formatted for output
       private String date_formatted = null;
   
       /**
        * Method called at start of tag, always returns EVAL_BODY_TAG
        *
  -     * @return always returns EVAL_BODY_TAG
  +     * @return EVAL_BODY_TAG
        */
  -    public int doStartTag() throws JspException
  +    public final int doStartTag() throws JspException
       {
   	return EVAL_BODY_TAG;
       }
  @@ -125,9 +133,9 @@
       /**
        * Method called at end of format tag body.
        *
  -     * @return always returns SKIP_BODY
  +     * @return SKIP_BODY
        */
  -    public int doAfterBody() throws JspException
  +    public final int doAfterBody() throws JspException
       {
   	// Use the body of the tag as input for the date
   	BodyContent body = getBodyContent();
  @@ -159,9 +167,10 @@
   
       /**
        * Method called at end of Tag
  +     *
        * @return EVAL_PAGE
        */
  -    public int doEndTag() throws JspException
  +    public final int doEndTag() throws JspException
       {
   	try {
   	    pageContext.getOut().write(date_formatted);
  @@ -173,10 +182,12 @@
       }
   
       /**
  -     * Locale flag, if set to true, format date for client's locale
  +     * Locale flag, if set to true, format date
        * for client's preferred locale if known.
  +     *
  +     * @param String use users locale, true or false
        */
  -    public void setLocale(String str)
  +    public final void setLocale(String str)
       {
   	if( str.equals("true") )
   	    locale = pageContext.getRequest().getLocale();
  @@ -187,8 +198,10 @@
        *
        * Value must be the name of a <b>timezone</b> tag script
        * variable ID.
  +     *
  +     * @param String name of timezone to use
        */
  -    public void setTimezone(String tz)
  +    public final void setTimezone(String tz)
       {
   	timezone = 
   	    (TimeZone)pageContext.getAttribute(tz,PageContext.SESSION_SCOPE);
  @@ -196,8 +209,10 @@
   
       /**
        * Set the pattern to use when formatting Date.
  +     *
  +     * @param String SimpleDateFormat style time pattern format string
        */
  -    public void setPattern(String str)
  +    public final void setPattern(String str)
       {
   	pattern = str;
       }