seade       2003/09/29 21:17:09

  Modified:    src/java/org/apache/turbine/services/pull/util Tag:
                        TURBINE_2_3_BRANCH DateFormatter.java
               xdocs    Tag: TURBINE_2_3_BRANCH changes.xml
  Log:
  Allows for a differnet date format to be provided via tool.dateTool.format in 
TR.props.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.3.2.1   +15 -3     
jakarta-turbine-2/src/java/org/apache/turbine/services/pull/util/DateFormatter.java
  
  Index: DateFormatter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/pull/util/DateFormatter.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- DateFormatter.java        9 Mar 2003 03:06:30 -0000       1.3
  +++ DateFormatter.java        30 Sep 2003 04:17:08 -0000      1.3.2.1
  @@ -58,12 +58,14 @@
   import java.util.Date;
   
   import org.apache.commons.lang.StringUtils;
  +import org.apache.turbine.Turbine;
   import org.apache.turbine.services.pull.ApplicationTool;
   
   /**
    * This pull tool is used to format date objects into strings.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Quinton McCombs</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Scott Eade</a>
    * @version $Id$
    */
   public class DateFormatter
  @@ -73,7 +75,15 @@
       private SimpleDateFormat sdf = new SimpleDateFormat();
   
       /** Default date format */
  -    private static final String defaultFormat = "MM/dd/yyyy";
  +    private static final String DATE_FORMAT_DEFAULT = "MM/dd/yyyy";
  +
  +    /**
  +     * Property tag for the date format that is to be used for the web 
  +     * application.
  +     */
  +    private static final String DATE_FORMAT_KEY = "tool.dateTool.format";
  +
  +    private String dateFormat = null;
   
       /**
        * Initialize the application tool. The data parameter holds a different
  @@ -87,6 +97,8 @@
        */
       public void init(Object data)
       {
  +        dateFormat = Turbine.getConfiguration()
  +                .getString(DATE_FORMAT_KEY, DATE_FORMAT_DEFAULT);
       }
   
       /**
  @@ -109,7 +121,7 @@
        */
       public String format(Date theDate)
       {
  -        return format(theDate, defaultFormat);
  +        return format(theDate, dateFormat);
       }
   
       /**
  
  
  
  No                   revision
  No                   revision
  1.60.2.7  +4 -0      jakarta-turbine-2/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/xdocs/changes.xml,v
  retrieving revision 1.60.2.6
  retrieving revision 1.60.2.7
  diff -u -r1.60.2.6 -r1.60.2.7
  --- changes.xml       29 Sep 2003 11:23:42 -0000      1.60.2.6
  +++ changes.xml       30 Sep 2003 04:17:09 -0000      1.60.2.7
  @@ -105,6 +105,10 @@
          Fixed the intake DateString flexible rule so that it applies to the
          format rules and not just to the default locale format.
       </li>
  +    <li>
  +       DateFormatter now allows for a differnet date format to be provided
  +       via <em>tool.dateTool.format</em> in TurbineResources.properties.
  +    </li>
     </ul>
   </p>
   </subsection>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to