click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r930852 - in /click/trunk/click/extras/src/org/apache/click/extras/control: DateField.java DateField.properties
Date Mon, 05 Apr 2010 12:58:01 GMT
Author: sabob
Date: Mon Apr  5 12:58:00 2010
New Revision: 930852

URL: http://svn.apache.org/viewvc?rev=930852&view=rev
Log:
load localized date format from resource bundle. CLK-610

Modified:
    click/trunk/click/extras/src/org/apache/click/extras/control/DateField.java
    click/trunk/click/extras/src/org/apache/click/extras/control/DateField.properties

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/DateField.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/DateField.java?rev=930852&r1=930851&r2=930852&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/DateField.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/DateField.java Mon Apr  5
12:58:00 2010
@@ -135,9 +135,6 @@ public class DateField extends TextField
 
     // -------------------------------------------------------------- Constants
 
-    /** The date default format pattern: "<tt>dd MMM yyyy</tt>". */
-    public static String defaultFormatPattern = "dd MMM yyyy";
-
     private static final long serialVersionUID = 1L;
 
     /** Supported locales. */
@@ -188,34 +185,46 @@ public class DateField extends TextField
     /**
      * Construct the Date Field with the given name.
      * <p/>
-     * The date format pattern will be set to <tt>dd MMM yyyy</tt>.
+     * The date format pattern will be set to the message
+     * <tt>"date-format-pattern"</tt> defined in the resource bundle
+     * <tt>/org/apache/click/extras/control/DateField.properties</tt>.
+     * <p/>
+     * The default date format pattern for English is <tt>"dd MMM yyyy"</tt>.
      *
      * @param name the name of the field
      */
     public DateField(String name) {
         super(name);
-        setAttribute("id", getName() + "_field");
-        setFormatPattern(defaultFormatPattern);
+        String dateFormatPattern = getMessage("date-format-pattern");
+        setFormatPattern(dateFormatPattern);
     }
 
     /**
      * Construct the Date Field with the given name and label.
      * <p/>
-     * The date format pattern will be set to <tt>dd MMM yyyy</tt>.
+     * The date format pattern will be set to the message
+     * <tt>"date-format-pattern"</tt> defined in the resource bundle
+     * <tt>/org/apache/click/extras/control/DateField.properties</tt>.
+     * <p/>
+     * The default date format pattern for English is <tt>"dd MMM yyyy"</tt>.
      *
      * @param name the name of the field
      * @param label the label of the field
      */
     public DateField(String name, String label) {
         super(name, label);
-        setAttribute("id", getName() + "_field");
-        setFormatPattern(defaultFormatPattern);
+        String dateFormatPattern = getMessage("date-format-pattern");
+        setFormatPattern(dateFormatPattern);
     }
 
     /**
      * Construct the Date Field with the given name and required status.
      * <p/>
-     * The date format pattern will be set to <tt>dd MMM yyyy</tt>.
+     * The date format pattern will be set to the message
+     * <tt>"date-format-pattern"</tt> defined in the resource bundle
+     * <tt>/org/apache/click/extras/control/DateField.properties</tt>.
+     * <p/>
+     * The default date format pattern for English is <tt>"dd MMM yyyy"</tt>.
      *
      * @param name the name of the field
      * @param required the field required status
@@ -228,7 +237,11 @@ public class DateField extends TextField
     /**
      * Construct the Date Field with the given name, label and required status.
      * <p/>
-     * The date format pattern will be set to <tt>dd MMM yyyy</tt>.
+     * The date format pattern will be set to the message
+     * <tt>"date-format-pattern"</tt> defined in the resource bundle
+     * <tt>/org/apache/click/extras/control/DateField.properties</tt>.
+     * <p/>
+     * The default date format pattern for English is <tt>"dd MMM yyyy"</tt>.
      *
      * @param name the name of the field
      * @param label the label of the field
@@ -236,12 +249,18 @@ public class DateField extends TextField
      */
     public DateField(String name, String label, boolean required) {
         super(name, label, required);
-        setAttribute("id", getName() + "_field");
-        setFormatPattern(defaultFormatPattern);
+        String dateFormatPattern = getMessage("date-format-pattern");
+        setFormatPattern(dateFormatPattern);
     }
 
     /**
      * Construct the Date Field with the given name, label and size.
+     * <p/>
+     * The date format pattern will be set to the message
+     * <tt>"date-format-pattern"</tt> defined in the resource bundle
+     * <tt>/org/apache/click/extras/control/DateField.properties</tt>.
+     * <p/>
+     * The default date format pattern for English is <tt>"dd MMM yyyy"</tt>.
      *
      * @param name the name of the field
      * @param label the label of the field
@@ -255,6 +274,12 @@ public class DateField extends TextField
     /**
      * Construct the Date Field with the given name, label, size and
      * required status.
+     * <p/>
+     * The date format pattern will be set to the message
+     * <tt>"date-format-pattern"</tt> defined in the resource bundle
+     * <tt>/org/apache/click/extras/control/DateField.properties</tt>.
+     * <p/>
+     * The default date format pattern for English is <tt>"dd MMM yyyy"</tt>.
      *
      * @param name the name of the field
      * @param label the label of the field
@@ -269,11 +294,18 @@ public class DateField extends TextField
     /**
      * Create a Date Field with no name defined.
      * <p/>
+     * The date format pattern will be set to the message
+     * <tt>"date-format-pattern"</tt> defined in the resource bundle
+     * <tt>/org/apache/click/extras/control/DateField.properties</tt>.
+     * <p/>
+     * The default date format pattern for English is <tt>"dd MMM yyyy"</tt>.
+     * <p/>
      * <b>Please note</b> the control's name must be defined before it is valid.
      */
     public DateField() {
         super();
-        setFormatPattern(defaultFormatPattern);
+        String dateFormatPattern = getMessage("date-format-pattern");
+        setFormatPattern(dateFormatPattern);
     }
 
     // ------------------------------------------------------ Public Attributes
@@ -451,7 +483,6 @@ public class DateField extends TextField
     @Override
     public void setName(String name) {
         super.setName(name);
-        setAttribute("id", getName() + "_field");
     }
 
     /**
@@ -728,8 +759,6 @@ public class DateField extends TextField
      * <ul>
      *   <li>/click-control.properties
      *     <ul>
-     *       <li>field-maxlength-error</li>
-     *       <li>field-minlength-error</li>
      *       <li>field-required-error</li>
      *     </ul>
      *   </li>

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/DateField.properties
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/DateField.properties?rev=930852&r1=930851&r2=930852&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/DateField.properties (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/DateField.properties Mon
Apr  5 12:58:00 2010
@@ -16,5 +16,6 @@
 # under the License.
 
 date-format-error={0} is invalid. Date format is {1}
+date-format-pattern=dd M yyyy
 date-title=Date format: {0}
 calendar-image-title=Calendar
\ No newline at end of file



Mime
View raw message