jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gl...@apache.org
Subject cvs commit: jakarta-taglibs/datetime/xml datetime.xml intro.xml
Date Sun, 26 Jan 2003 13:33:32 GMT
glenn       2003/01/26 05:33:32

  Modified:    datetime/examples/web datetime.jsp setzone.jsp
               datetime/src/org/apache/taglibs/datetime FormatTag.java
               datetime/xml datetime.xml intro.xml
  Added:       datetime/src/org/apache/taglibs/datetime
                        DateFormatSymbolsTEI.java DateFormatSymbolsTag.java
  Log:
  Commit new dateFormatSymbols tag feature submitted by Igor Kozlov
  
  Revision  Changes    Path
  1.3       +1 -0      jakarta-taglibs/datetime/examples/web/datetime.jsp
  
  Index: datetime.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/datetime/examples/web/datetime.jsp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- datetime.jsp	7 Jul 2001 20:41:34 -0000	1.2
  +++ datetime.jsp	26 Jan 2003 13:33:31 -0000	1.3
  @@ -10,6 +10,7 @@
   <h1>
   Jakarta DATETIME Taglib Example</h1></center>
   <br>
  +<%@ page session="false" %>
   <%@ taglib uri="http://jakarta.apache.org/taglibs/datetime-1.0" prefix="dt" %>
   <p>
   <form action="setzone.jsp">
  
  
  
  1.4       +1 -0      jakarta-taglibs/datetime/examples/web/setzone.jsp
  
  Index: setzone.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/datetime/examples/web/setzone.jsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- setzone.jsp	13 Jul 2001 14:56:04 -0000	1.3
  +++ setzone.jsp	26 Jan 2003 13:33:31 -0000	1.4
  @@ -10,6 +10,7 @@
   <h1>
   Jakarta DATETIME Taglib Example</h1></center>
   <br>
  +<%@ page session="false" %>
   <%@ taglib uri="http://jakarta.apache.org/taglibs/datetime-1.0" prefix="dt" %>
   <%@ taglib uri="http://jakarta.apache.org/taglibs/request-1.0" prefix="req" %>
   <p>
  
  
  
  1.12      +99 -55    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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FormatTag.java	6 Apr 2002 18:10:51 -0000	1.11
  +++ FormatTag.java	26 Jan 2003 13:33:32 -0000	1.12
  @@ -122,12 +122,12 @@
    *     &lt;required&gt;false&lt;/required&gt;
    *     &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
    *   &lt;/attribute&gt;
  - *   &lt;attribute&gt;                             
  + *   &lt;attribute&gt;
    *     &lt;name&gt;date&lt;/name&gt;
    *     &lt;required&gt;false&lt;/required&gt;
    *     &lt;rtexprvalue&gt;true&lt;/rtexprvalue&gt;
    *   &lt;/attribute&gt;
  - *   &lt;attribute&gt;                             
  + *   &lt;attribute&gt;
    *     &lt;name&gt;default&lt;/name&gt;
    *     &lt;required&gt;false&lt;/required&gt;
    *     &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
  @@ -137,6 +137,11 @@
    *     &lt;required&gt;false&lt;/required&gt;
    *     &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
    *   &lt;/attribute&gt;
  + *   &lt;attribute&gt;
  + *     &lt;name&gt;symbolsRef&lt;/name&gt;
  + *     &lt;required&gt;false&lt;/required&gt;
  + *     &lt;rtexprvalue&gt;false&lt;/rtexprvalue&gt;
  + *   &lt;/attribute&gt;
    * </pre>
    *
    * @author Glenn Nielsen
  @@ -162,9 +167,13 @@
       private String default_text = "Invalid Date";
       // Optional attribute, the name of an attribute which contains the Locale
       private String localeRef = null;
  +    // Optional attribute, name of script variable to use as date symbols source
  +    private String symbolsRef = null;
   
       // format tag invocation variables
   
  +    // The symbols object
  +    private DateFormatSymbols symbols = null;
       // The date to be formatted an output by tag
       private Date output_date = null;
   
  @@ -176,7 +185,7 @@
       public final int doStartTag() throws JspException
       {
           output_date = date;
  -	return EVAL_BODY_TAG;
  +        return EVAL_BODY_TAG;
       }
   
       /**
  @@ -186,19 +195,19 @@
        */
       public final int doAfterBody() throws JspException
       {
  -	// Use the body of the tag as input for the date
  -	BodyContent body = getBodyContent();
  -	String s = body.getString().trim();  
  -	// Clear the body since we will output only the formatted date
  -	body.clearBody();
  -	if( output_date == null ) {
  -	    long time;
  -	    try {
  -	        time = Long.valueOf(s).longValue();
  +        // Use the body of the tag as input for the date
  +        BodyContent body = getBodyContent();
  +        String s = body.getString().trim();  
  +        // Clear the body since we will output only the formatted date
  +        body.clearBody();
  +        if( output_date == null ) {
  +            long time;
  +            try {
  +                time = Long.valueOf(s).longValue();
                   output_date = new Date(time);
  -	    } catch(NumberFormatException nfe) {
  -	    }
  -	}
  +            } catch(NumberFormatException nfe) {
  +            }
  +        }
   
           return SKIP_BODY;
       }
  @@ -212,63 +221,88 @@
       {
           String date_formatted = default_text;
   
  -        if( output_date != null ) {
  +        if (output_date != null) {
               // Get the pattern to use
               SimpleDateFormat sdf;
               String pat = pattern;
  -    
  -            if( pat == null && patternid != null ) {
  -              Object attr = pageContext.findAttribute(patternid);
  -              if( attr != null )
  -                pat = attr.toString();
  +
  +            if (pat == null && patternid != null) {
  +                Object attr = pageContext.findAttribute(patternid);
  +                if (attr != null)
  +                    pat = attr.toString();
               }
  -    
  -            if( pat == null ) {
  +
  +            if (pat == null) {
                   sdf = new SimpleDateFormat();
                   pat = sdf.toPattern();
               }
  -    
  +
  +            // Get a DateFormatSymbols
  +            if (symbolsRef != null) {
  +                symbols = (DateFormatSymbols) pageContext.findAttribute(symbolsRef);
  +                if (symbols == null) {
  +                    throw new JspException(
  +                            "datetime format tag could not find dateFormatSymbols for symbolsRef
\"" +
  +                            symbolsRef + "\".");
  +                }
  +            }
  +
               // Get a SimpleDateFormat using locale if necessary
  -            if( localeRef != null ) {
  -                Locale locale = (Locale)pageContext.findAttribute(localeRef);
  -                if( locale == null ) {                                       
  -                    throw new JspException(                                  
  -                        "datetime format tag could not find locale for localeRef \"" +
  -                        localeRef + "\".");                                          
  -                }                                                                    
  -                                           
  -                sdf = new SimpleDateFormat(pat,locale);
  -            } else if( locale_flag ) {                     
  -                sdf = new SimpleDateFormat(pat,        
  -                          (Locale)pageContext.getRequest().getLocale());
  -            } else {                                                    
  +            if (localeRef != null) {
  +                Locale locale = (Locale) pageContext.findAttribute(localeRef);
  +                if (locale == null) {
  +                    throw new JspException(
  +                            "datetime format tag could not find locale for localeRef \""
+
  +                            localeRef + "\".");
  +                }
  +
  +                sdf = new SimpleDateFormat(pat, locale);
  +            } else if (locale_flag) {
  +                sdf = new SimpleDateFormat(pat,
  +                        (Locale) pageContext.getRequest().getLocale());
  +            } else if (symbols != null) {
  +                sdf = new SimpleDateFormat(pat,
  +                        symbols);
  +            } else {
                   sdf = new SimpleDateFormat(pat);
               }
   
               // See if there is a timeZone
  -            if( timeZone_string != null ) {
  +            if (timeZone_string != null) {
                   TimeZone timeZone =
  -                    (TimeZone)pageContext.getAttribute(timeZone_string,
  -                                                       PageContext.SESSION_SCOPE);
  -                if( timeZone == null ) {
  +                        (TimeZone) pageContext.getAttribute(timeZone_string,
  +                                PageContext.SESSION_SCOPE);
  +                if (timeZone == null) {
                       throw new JspTagException("Datetime format tag timeZone " +
  -                        "script variable \"" + timeZone_string +
  -                        " \" does not exist");
  +                            "script variable \"" + timeZone_string +
  +                            " \" does not exist");
                   }
                   sdf.setTimeZone(timeZone);
               }
  -    
  +
               // Format the date for display
               date_formatted = sdf.format(output_date);
           }
   
  -	try {
  -	    pageContext.getOut().write(date_formatted);
  -	} catch(Exception e) {
  -	    throw new JspException("IO Error: " + e.getMessage());
  -	}
  +        try {
  +            pageContext.getOut().write(date_formatted);
  +        } catch (Exception e) {
  +            throw new JspException("IO Error: " + e.getMessage());
  +        }
   
  -	return EVAL_PAGE;
  +        return EVAL_PAGE;
  +    }
  +
  +    public void release()
  +    {
  +        super.release();
  +        locale_flag = false;
  +        pattern = null;
  +        patternid = null;
  +        date = null;
  +        localeRef = null;
  +        symbolsRef = null;
  +        symbols = null;
       }
   
       /**
  @@ -292,7 +326,7 @@
        */
       public final void setTimeZone(String tz)
       {
  -	timeZone_string = tz;
  +        timeZone_string = tz;
       }
   
       /**
  @@ -302,7 +336,7 @@
        */
       public final void setPattern(String str)
       {
  -	pattern = str;
  +        pattern = str;
       }
   
       /**
  @@ -347,4 +381,14 @@
           localeRef = value;
       }
   
  +    /**
  +     * Provides a key to search the page context for in order to get the
  +     * java.text.DateFormatSymbols to use
  +     *
  +     * @param symbolsRef
  +     */
  +    public void setSymbolsRef(String symbolsRef) throws JspException
  +    {
  +        this.symbolsRef = symbolsRef;
  +    }
   }
  
  
  
  1.1                  jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/DateFormatSymbolsTEI.java
  
  Index: DateFormatSymbolsTEI.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/DateFormatSymbolsTEI.java,v
1.1 2003/01/26 13:33:32 glenn Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/26 13:33:32 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.datetime;
  
  import javax.servlet.jsp.tagext.TagExtraInfo;
  import javax.servlet.jsp.tagext.VariableInfo;
  import javax.servlet.jsp.tagext.TagData;
  
  /**
   * TagExtraInfo for <b>dateFormatSymbols</b> tag, allows use of standard
   * &lt;jsp:getProperty/&gt; with the <b>dateFormatSymbols</b> tag script
   * variable id.
   * 
   * @see DateFormatSymbolsTag
   *
   * @author <a href="mailto:wigor@bigmir.net">Kozlov Igor</a>
   */
  public class DateFormatSymbolsTEI extends TagExtraInfo {
  
      public VariableInfo[] getVariableInfo(TagData data) {
          String varName = data.getAttributeString("id");
          if (varName == null) {
              return new VariableInfo[]{
              };
          } else {
              return new VariableInfo[]{
                  new VariableInfo(varName,
                          "java.text.DateFormatSymbols",
                          true,
                          VariableInfo.AT_BEGIN),
              };
          }
      }
  
  
  }
  
  
  
  1.1                  jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/DateFormatSymbolsTag.java
  
  Index: DateFormatSymbolsTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/DateFormatSymbolsTag.java,v
1.1 2003/01/26 13:33:32 glenn Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/26 13:33:32 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.datetime;
  
  import java.util.Locale;
  import java.util.ResourceBundle;
  import java.util.MissingResourceException;
  import java.text.DateFormatSymbols;
  import javax.servlet.jsp.tagext.TagSupport;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.JspException;
  
  /**
   * <p>
   * This class implements an empty tag that allows you to use a custom symbols
   * for date formating.</p>
   * <p>
   * Must be specified attribute baseName that point to property file.
   * </p>
   * <p>
   * Property file contains key\value pair in such rule<br>
   * # Month symbols change on custom<br>
   * month=true<br>
   * month0=January<br>
   * month1=February<br>
   * # Era symbols change on custom<br>
   * era=true<br>
   * era0=before<br>
   * era1=after<br>
   *
   * </p>
   *
   * @author <a href="mailto:wigor@bigmir.net">Kozlov Igor</a>
   */
  public class DateFormatSymbolsTag extends TagSupport {
  
      private int scope = PageContext.PAGE_SCOPE;
      private String localeRef = null;
      private boolean locale_flag = false;
      private String baseName = null;
  
      private ResourceBundle bundle;
      private DateFormatSymbols dateFormatSymbols;
  
      public void setScope(String scope) {
          if (scope.toLowerCase().equals("application")) {
              this.scope = PageContext.APPLICATION_SCOPE;
          } else if (scope.toLowerCase().equals("session")) {
              this.scope = PageContext.SESSION_SCOPE;
          } else if (scope.toLowerCase().equals("request")) {
              this.scope = PageContext.REQUEST_SCOPE;
          } else if (scope.toLowerCase().equals("page")) {
              this.scope = PageContext.PAGE_SCOPE;
          }
      }
  
      public void setBaseName(String baseName) {
          this.baseName = baseName;
      }
  
      public void setLocale(boolean locale) {
          this.locale_flag = locale;
      }
  
      public void setLocaleRef(String localeRef) {
          this.localeRef = localeRef;
      }
  
      public int doStartTag() throws JspException {
          Locale locale = null;
          if (localeRef != null) {
              locale = (Locale) pageContext.findAttribute(localeRef);
          } else if (locale_flag) {
              locale = pageContext.getRequest().getLocale();
          } else {
              dateFormatSymbols = new DateFormatSymbols();
          }
          findBundle(locale);
          buildDateFormatSymbols(locale);
          if (this.getId() != null) {
              pageContext.setAttribute(this.getId(), dateFormatSymbols, scope);
          }
          return SKIP_BODY;
      }
  
      public void release() {
          super.release();
          scope = PageContext.PAGE_SCOPE;
          localeRef = null;
          locale_flag = false;
          baseName = null;
      }
  
      private void buildDateFormatSymbols(Locale locale) {
          if (locale != null) {
              dateFormatSymbols = new DateFormatSymbols(locale);
          } else {
              dateFormatSymbols = new DateFormatSymbols();
          }
          // Set ampm string
          try {
              String customAmPm = bundle.getString("ampm");
              if ("true".equals(customAmPm)) {
                  String ampm[] = new String[2];
                  for (int i = 0; i < 2; i++) {
                      ampm[i] = bundle.getString("ampm" + i);
                  }
                  dateFormatSymbols.setAmPmStrings(ampm);
              }
          } catch (MissingResourceException e) {
          }
  
          // Set era strings
          try {
              String customEras = bundle.getString("eras");
              if ("true".equals(customEras)) {
                  String eras[] = new String[2];
                  for (int i = 0; i < 2; i++) {
                      eras[i] = bundle.getString("eras" + i);
                  }
                  dateFormatSymbols.setEras(eras);
              }
          } catch (MissingResourceException e) {
          }
  
          // Set short month strings
          try {
              String customShortMonth = bundle.getString("shortmonth");
              if ("true".equals(customShortMonth)) {
                  String shortmonth[] = new String[12];
                  for (int i = 0; i < 12; i++) {
                      shortmonth[i] = bundle.getString("shortmonth" + i);
                  }
                  dateFormatSymbols.setShortMonths(shortmonth);
              }
          } catch (MissingResourceException e) {
          }
  
          // Set month strings
          try {
              String customMonth = bundle.getString("month");
              if ("true".equals(customMonth)) {
                  String month[] = new String[12];
                  for (int i = 0; i < 12; i++) {
                      month[i] = bundle.getString("month" + i);
                  }
                  dateFormatSymbols.setMonths(month);
              }
          } catch (MissingResourceException e) {
          }
  
          // Set weekdays strings
          try {
              String customWeekdays = bundle.getString("weekdays");
              if ("true".equals(customWeekdays)) {
                  String weekdays[] = new String[7];
                  for (int i = 0; i < 7; i++) {
                      weekdays[i] = bundle.getString("weekdays" + i);
                  }
                  dateFormatSymbols.setWeekdays(weekdays);
              }
          } catch (MissingResourceException e) {
          }
  
          // Set short weekdays strings
          try {
              String customShortWeekdays = bundle.getString("shortweekdays");
              if ("true".equals(customShortWeekdays)) {
                  String shortweekdays[] = new String[7];
                  for (int i = 0; i < 7; i++) {
                      shortweekdays[i] = bundle.getString("shortweekdays" + i);
                  }
                  dateFormatSymbols.setShortWeekdays(shortweekdays);
              }
          } catch (MissingResourceException e) {
          }
      }
  
      private void findBundle(Locale locale) {
          if (locale != null) {
              ClassLoader cl = Thread.currentThread().getContextClassLoader();
              bundle = ResourceBundle.getBundle(baseName, locale, cl);
          } else {
              bundle = ResourceBundle.getBundle(baseName);
          }
      }
  
  }
  
  
  
  1.13      +198 -45   jakarta-taglibs/datetime/xml/datetime.xml
  
  Index: datetime.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/datetime/xml/datetime.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- datetime.xml	1 Dec 2002 17:38:09 -0000	1.12
  +++ datetime.xml	26 Jan 2003 13:33:32 -0000	1.13
  @@ -1,6 +1,6 @@
   <?xml version="1.0" ?>
   
  -<!-- Change all instances of datetime with the jakarta-taglib 
  +<!-- Change all instances of datetime with the jakarta-taglib
        name for this tag library.
   
        Change all instances of Datetime with the name to use
  @@ -15,7 +15,7 @@
   <!-- More properties can be added.  Good place to stick loose
        data needed elsewhere. -->
   <properties>
  -  <!-- The title here overrides the title generated by the 
  +  <!-- The title here overrides the title generated by the
          stylesheet for the documentation HTML <title> tag
     <title>Jakarta Project: Datetime JSP Tag Library</title>
          -->
  @@ -55,7 +55,7 @@
          Enter information here as straight XHTML paragraphs.  Inside the
          paragraphs regular XHTML can be used (but an external CSS is
          encouraged). The information is copied into the generated HTML doc,
  -       and the <p> elements are essential for that. --> 
  +       and the <p> elements are essential for that. -->
     <description>
   <p>
   The DATETIME custom tag library contains tags which can be used to handle
  @@ -80,7 +80,7 @@
          the "Requirements" section of the HTML doc. -->
     <requirements-info>
       This custom tag library requires no software other than a servlet container
  -    that supports the JavaServer Pages Specification, version 1.1 or higher.  
  +    that supports the JavaServer Pages Specification, version 1.1 or higher.
     </requirements-info>
   
     <toc href="pattern" name="Date Time Pattern Format">
  @@ -131,7 +131,7 @@
    <p>
    A pattern containing any invalid pattern letter will result in a thrown
    exception during formatting or parsing.</p>
  -  
  +
    <p>
    <strong>Examples Using the US Locale:</strong>
    <pre>
  @@ -154,7 +154,7 @@
   
     <tagtoc name="Date Tags">
       <tag>
  -      <name>currentTime</name> 
  +      <name>currentTime</name>
         <tag-class>org.apache.taglibs.datetime.CurrentTimeTag</tag-class>
         <body-content>empty</body-content>
         <display-name>currentTime</display-name>
  @@ -194,14 +194,14 @@
   <![CDATA[
   The current time in milliseconds since midnight January 1, 1970 GMT is:
   <dt:currentTime/>
  -]]> 
  +]]>
             </code>
           </usage>
         </example>
   
       </tag>
   
  -    <tag> 
  +    <tag>
         <name>format</name>
         <tag-class>org.apache.taglibs.datetime.FormatTag</tag-class>
         <body-content>JSP</body-content>
  @@ -282,7 +282,7 @@
           <required>no</required>
           <rtexprvalue>yes</rtexprvalue>
           <!-- Used for JSP 1.2 TLD and generating HTML docs -->
  -        <description> 
  +        <description>
             Set the date to format by passing in a Date object
             using a runtime expression value.
           </description>
  @@ -293,11 +293,23 @@
         </attribute>
   
         <attribute>
  +        <name>symbolsRef</name>
  +        <required>no</required>
  +        <rtexprvalue>yes</rtexprvalue>
  +        <!-- Used for JSP 1.2 TLD and generating HTML docs -->
  +        <description>
  +            Specify the name of a page, session, application, or request scope
  +            attribute of type java.text.DateFormatSymbols to use for symbols.
  +        </description>
  +        <availability>1.1</availability>
  +      </attribute>
  +
  +      <attribute>
           <name>default</name>
           <required>no</required>
           <rtexprvalue>no</rtexprvalue>
           <!-- Used for JSP 1.2 TLD and generating HTML docs -->
  -        <description> 
  +        <description>
             Set the default text to output if their is not
             a valid date input as a date object or in the tag body.
           </description>
  @@ -312,7 +324,7 @@
           <required>no</required>
           <rtexprvalue>no</rtexprvalue>
           <!-- Used for JSP 1.2 TLD and generating HTML docs -->
  -        <description> 
  +        <description>
             Set to "<b>true</b>" to use the clients locale,
             if known, when formatting date.
           </description>
  @@ -326,7 +338,7 @@
           <name>localeRef</name>
           <required>false</required>
           <rtexprvalue>false</rtexprvalue>
  -        <description> 
  +        <description>
             Specify the name of a page, session, application, or request scope
             attribute of type java.util.Locale to use for locale.
           </description>
  @@ -357,6 +369,134 @@
       </tag>
   
       <tag>
  +      <name>dateFormatSymbols</name>
  +      <tag-class>org.apache.taglibs.datetime.DateFormatSymbolsTag</tag-class>
  +      <tei-class>org.apache.taglibs.datetime.DateFormatSymbolsTEI</tei-class>
  +      <body-content>EMPTY</body-content>
  +      <display-name>dateFormatSymbols</display-name>
  +
  +      <!-- Complete description of this tag.  Used for JSP 1.2 TLD
  +           and for generating HTML documentation. -->
  +      <description>
  +          <p>Create DateFormatSymbols object that will be used for formating.</p>
  +      </description>
  +
  +      <!-- One line summary of what tag does for Tag Summary section -->
  +      <summary>
  +        Parses a date string and outputs the time in milliseconds since
  +        Jan 1, 1970 GMT.
  +      </summary>
  +      <availability>1.1</availability>
  +      <restrictions>
  +          This tag must be placed early in the page (before call of format tag with symbolsRef
attribute)
  +      </restrictions>
  +
  +        <!-- Declaration of scripting variables created by tag. Used for
  +             generating HTML documentation and for JSP 1.2 DTD. -->
  +      <variable>
  +          <!-- name-given or name-from-attribute must be declared -->
  +          <name-from-attribute>id</name-from-attribute>
  +          <!-- Optional variable declarations -->
  +          <!-- Package and class name of variable, default java.lang.String -->
  +          <variable-class>java.text.DateFormatSymbols</variable-class>
  +          <!-- Usage for declare is not clear in JSP1.2PFD, default true -->
  +          <declare>true</declare>
  +          <!-- scope of scripting variable, default NESTED -->
  +          <scope>AT_BEGIN</scope>
  +          <!-- description of scripting variable -->
  +          <description>
  +            The scripting variable declared allows other tags or scriptlets
  +            to access the DateFormatSymbols defined by this tag.
  +          </description>
  +          <!-- Used for HTML documentation. Version added, or deprecated. -->
  +          <availability>1.1</availability>
  +      </variable>
  +
  +      <attribute>
  +          <name>id</name>
  +          <required>true</required>
  +          <rtexprvalue>true</rtexprvalue>
  +          <description>
  +            Script variable id for use with standard <b>jsp:getProperty</b>
  +            tag and as an attribute to other tags in this tag library.
  +          </description>
  +          <availability>1.1</availability>
  +      </attribute>
  +
  +      <attribute>
  +            <name>baseName</name>
  +            <required>true</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <description>
  +                Specify the name to locate ResourceBundle
  +            </description>
  +            <availability>1.1</availability>
  +      </attribute>
  +
  +        <attribute>
  +          <name>locale</name>
  +          <required>no</required>
  +          <rtexprvalue>no</rtexprvalue>
  +          <!-- Used for JSP 1.2 TLD and generating HTML docs -->
  +          <description>
  +            Set to "<b>true</b>" to use the clients locale,
  +            if known, when formatting date.
  +          </description>
  +          <!-- Used for the HTML documentation only.
  +               Version of taglib when this attribute became available,
  +               deprecated is a possible value. -->
  +          <availability>1.1</availability>
  +        </attribute>
  +
  +        <attribute>
  +          <name>localeRef</name>
  +          <required>false</required>
  +          <rtexprvalue>false</rtexprvalue>
  +          <description>
  +            Specify the name of a page, session, application, or request scope
  +            attribute of type java.util.Locale to use for locale.
  +          </description>
  +          <availability>1.1</availability>
  +        </attribute>
  +
  +      <attribute>
  +          <name>scope</name>
  +          <required>false</required>
  +          <rtexprvalue>false</rtexprvalue>
  +          <description>
  +              Specify the scope that will be used for store DateFormatSymbols variable
  +          </description>
  +          <availability>1.1</availability>
  +      </attribute>
  +
  +      <example>
  +          <usage>
  +              <comment>
  +                  Display the current time formatted
  +              </comment>
  +              <code>
  +<![CDATA[
  +<dt:dateFormatSymbols id="symbols" baseName="DateFormatSymbolsProperties"/>
  +<dt:format symbolsRef="symbols"><dt:currentTime/></dt:format>
  +
  +Attribute baseName point to property file with this format:
  +
  +DateFormatSymbolsProperties.properties
  +# Month symbols change on custom<br>
  +month=true<br>
  +month0=January<br>
  +month1=February<br>
  +# Era symbols change on custom<br>
  +era=true<br>
  +era0=before<br>
  +era1=after<br>
  +]]>
  +              </code>
  +          </usage>
  +      </example>
  +    </tag>
  +
  +    <tag>
         <name>parse</name>
         <tag-class>org.apache.taglibs.datetime.ParseTag</tag-class>
         <body-content>JSP</body-content>
  @@ -406,8 +546,8 @@
           <rtexprvalue>no</rtexprvalue>
           <!-- Used for JSP 1.2 TLD and generating HTML docs -->
           <description>
  -          Name of a script variable which contains a 
  -          <a href="#pattern">Date Time Pattern Format</a> 
  +          Name of a script variable which contains a
  +          <a href="#pattern">Date Time Pattern Format</a>
             string to use when parsing the date.
           </description>
           <!-- Used for the HTML documentation only.
  @@ -450,7 +590,7 @@
           <name>localeRef</name>
           <required>false</required>
           <rtexprvalue>false</rtexprvalue>
  -        <description> 
  +        <description>
             Specify the name of a page, session, application, or request scope
             attribute of type java.util.Locale to use for locale.
           </description>
  @@ -478,7 +618,7 @@
             </code>
           </usage>
         </example>
  -      
  +
       </tag>
   
       <tag>
  @@ -514,7 +654,7 @@
   
         <!-- Declaration of scripting variables created by tag.
              Used for generating HTML documentation and for
  -           JSP 1.2 DTD. -->  
  +           JSP 1.2 DTD. -->
         <variable>
           <!-- name-given or name-from-attribute must be declared
           <name-given>foo</name-given>
  @@ -531,12 +671,12 @@
           <description>
             A TimeZone for use with <b>parse</b> and <b>format</b>
tags.
           </description>
  -                             
  +
           <!-- Used for the HTML documentation only.
                Version of taglib when this script variable became available,
                deprecated is a possible value. -->
           <availability>1.0</availability>
  -                             
  +
         </variable>
   
         <attribute>
  @@ -557,9 +697,9 @@
              syntax highlighting by the XSL sheet. Multiple usage sections
              are allowed, and each will be display as a separate example
              in the resultant HTML. -->
  -      <example> 
  +      <example>
           <usage>
  -          <comment> 
  +          <comment>
               Sets the time zone to America/Chicago
             </comment>
             <code>
  @@ -567,11 +707,11 @@
   <dt:timeZone id="tz">America/Chicago</dt:timeZone>
   The current time in America/Chicago is:
   <dt:format timeZone="tz"><dt:currentTime/></dt:format>
  -]]> 
  +]]>
             </code>
           </usage>
         </example>
  -      
  +
       </tag>
   
     </tagtoc>
  @@ -595,9 +735,9 @@
         <availability>1.0</availability>
         <!-- Any restrictions on use of the tag -->
         <restrictions>None</restrictions>
  -     
  +
         <variable>
  -        <!-- name-given or name-from-attribute must be declared  
  +        <!-- name-given or name-from-attribute must be declared
           <name-given>foo</name-given>
                -->
           <name-from-attribute>id</name-from-attribute>
  @@ -607,7 +747,7 @@
           <!-- Usage for declare is not clear in JSP1.2PFD, default true -->
           <declare>true</declare>
           <!-- scope of scripting variable, default NESTED -->
  -        <scope>NESTED</scope> 
  +        <scope>NESTED</scope>
           <!-- description of scripting variable -->
           <description>TimeZones Bean</description>
   
  @@ -615,7 +755,7 @@
                Version of taglib when this script variable became available,
                deprecated is a possible value. -->
           <availability>1.0</availability>
  -     
  +
           <!-- If the tag creates a script variable or attribute which
                is a bean, the following declarations can be used to generate
                HTML documentation for 0 .. N properties.  -->
  @@ -665,7 +805,7 @@
           <name>localeRef</name>
           <required>false</required>
           <rtexprvalue>false</rtexprvalue>
  -        <description> 
  +        <description>
             Specify the name of a page, session, application, or request scope
             attribute of type java.util.Locale to use for locale.
           </description>
  @@ -687,7 +827,7 @@
             <comment>
               Generate a time zone select box
             </comment>
  -         
  +
             <code>
   <![CDATA[
   Select a Time Zone
  @@ -702,7 +842,7 @@
             </code>
           </usage>
         </example>
  -         
  +
       </tag>
   
       <tag>
  @@ -722,7 +862,7 @@
         <availability>1.0</availability>
         <!-- Any restrictions on use of the tag -->
         <restrictions>None</restrictions>
  -      
  +
         <variable>
           <name-from-attribute>id</name-from-attribute>
           <!-- Optional variable declarations -->
  @@ -759,7 +899,7 @@
             <availability>1.0</availability>
           </beanprop>
           <beanprop>
  -          <name>shortMonth</name>      
  +          <name>shortMonth</name>
             <get>Yes</get>
             <set>No</set>
             <description>
  @@ -795,7 +935,7 @@
           <name>localeRef</name>
           <required>false</required>
           <rtexprvalue>false</rtexprvalue>
  -        <description> 
  +        <description>
             Specify the name of a page, session, application, or request scope
             attribute of type java.util.Locale to use for locale.
           </description>
  @@ -807,7 +947,7 @@
             <comment>
               Generate a Month select box
             </comment>
  -      
  +
             <code>
   <![CDATA[
   Select a Month
  @@ -821,7 +961,7 @@
             </code>
           </usage>
         </example>
  -      
  +
       </tag>
   
       <tag>
  @@ -844,7 +984,7 @@
   
         <variable>
           <name-from-attribute>id</name-from-attribute>
  -        <!-- Optional variable declarations -->     
  +        <!-- Optional variable declarations -->
           <!-- Package and class name of variable, default java.lang.String -->
           <variable-class>org.apache.taglibs.datetime.WeekdaysTag</variable-class>
           <!-- Usage for declare is not clear in JSP1.2PFD, default true -->
  @@ -870,7 +1010,7 @@
           </beanprop>
           <beanprop>
             <name>weekday</name>
  -          <get>Yes</get>   
  +          <get>Yes</get>
             <set>No</set>
             <description>
               Returns the full name of the day of the week.
  @@ -914,7 +1054,7 @@
           <name>localeRef</name>
           <required>false</required>
           <rtexprvalue>false</rtexprvalue>
  -        <description> 
  +        <description>
             Specify the name of a page, session, application, or request scope
             attribute of type java.util.Locale to use for locale.
           </description>
  @@ -1072,16 +1212,16 @@
           <!-- scope of scripting variable, default NESTED -->
           <scope>NESTED</scope>
           <!-- description of scripting variable -->
  -        <description>Era names Bean</description>     
  -      
  +        <description>Era names Bean</description>
  +
           <!-- Used for the HTML documentation only.
                Version of taglib when this script variable became available,
                deprecated is a possible value. -->
           <availability>1.0</availability>
  -      
  +
           <beanprop>
             <name>name</name>
  -          <get>Yes</get>  
  +          <get>Yes</get>
             <set>No</set>
             <description>
               Returns the era name.
  @@ -1116,7 +1256,7 @@
           <name>localeRef</name>
           <required>false</required>
           <rtexprvalue>false</rtexprvalue>
  -        <description> 
  +        <description>
             Specify the name of a page, session, application, or request scope
             attribute of type java.util.Locale to use for locale.
           </description>
  @@ -1149,6 +1289,19 @@
   
   </taglib>
   
  +<revision release="1.1 Development" date="01/26/2003">
  +  <description>Added new features</description>
  +  <section name="Changes">
  +    <item>
  +      Added <b>dateFormatSymbols</b> tag.
  +    </item>
  +    <item>
  +      Added support for <b>dateFormatSymbols</b> <b>symbolsRef</b>
  +      script variable to the <b>format</b> tag.
  +    </item>
  +  </section>
  +</revision>
  +
   <revision release="1.0.1" date="12/1/2002">
     <description>1.0.1 Release</description>
     <section name="Changes">
  @@ -1198,7 +1351,7 @@
         Changed the name of the <b>timeZone</b> tag to
         <b>timeZone</b>.
       </item>
  -    <item> 
  +    <item>
         Changed the name of the <b>timezones</b> tag to
         <b>timeZones</b>.
       </item>
  @@ -1239,7 +1392,7 @@
     </section>
   </revision>
   
  -<revision release="Development" date="11/05/2000"> 
  +<revision release="Development" date="11/05/2000">
     <description>
       Initial version of tag library before Jakarta-Taglibs
       had an official release policy for tag libraries.
  
  
  
  1.6       +1 -0      jakarta-taglibs/datetime/xml/intro.xml
  
  Index: intro.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/datetime/xml/intro.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- intro.xml	1 Dec 2002 17:38:09 -0000	1.5
  +++ intro.xml	26 Jan 2003 13:33:32 -0000	1.6
  @@ -101,6 +101,7 @@
   
     <ul>
     <li>Glenn Nielsen</li>
  +  <li>Igor Kozlov</li>
     </ul>
   
     </section>
  
  
  

--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message