seade       2003/09/29 21:17:33

  Modified:    src/java/org/apache/turbine/services/pull/util
                        DateFormatter.java
               xdocs    changes.xml
  Log:
  Allows for a differnet date format to be provided via tool.dateTool.format in 
TR.props.
  
  Revision  Changes    Path
  1.4       +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.4
  diff -u -r1.3 -r1.4
  --- DateFormatter.java        9 Mar 2003 03:06:30 -0000       1.3
  +++ DateFormatter.java        30 Sep 2003 04:17:32 -0000      1.4
  @@ -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);
       }
   
       /**
  
  
  
  1.70      +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.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- changes.xml       29 Sep 2003 11:24:05 -0000      1.69
  +++ changes.xml       30 Sep 2003 04:17:33 -0000      1.70
  @@ -119,6 +119,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