Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for 
change notification.

The following page has been changed by SvenHomburg:
http://wiki.apache.org/tapestry/Tapestry5LocalizedDateField

------------------------------------------------------------------------------
  ''
  
  ==== possible solution ====
- create a subclass from !DateField like this
- {{{
- public class LocaleDateField extends DateField
- {
-     @Inject
-     private Messages _messages;
- 
-     /**
-      * Invoked to allow subclasses to further configure the parameters passed 
to the JavaScript
-      * Calendar.setup() function. The values inputField, ifFormat and button 
are pre-configured.
-      * Subclasses may override this method to configure additional features 
of the client-side
-      * Calendar. This implementation does nothing.
-      *
-      * @param setup parameters object
-      */
-     protected void configure(JSONObject setup)
-     {
-         setup.put("ifFormat", _messages.get("format.date.picker"));
-     }
- }
- }}}
- [[BR]]
  create or add to application's global properties
  {{{
- format.date.field : dd.MM.yyyy
- format.date.picker : %d.%m.%Y
+ format.date.field : %d.%m.%Y
  }}}
  [[BR]]
  add the class '''!AppPropertyEditBlocks''' in your page subpackage
@@ -57, +34 @@

          return _context;
      }
  
-     @SuppressWarnings("unused")
      @Component(parameters = {"value=context.propertyValue", 
"label=prop:context.label", "clientId=prop:context.propertyid",
-             "validate=prop:dateFieldValidator", 
"format=message:format.date.field"})
+             "validate=prop:dateFieldValidator", 
"format=prop:dateFieldFormat"})
-     private LocaleDateField _dateField;
+     private DateField _dateField;
+ 
+     public String getDateFieldFormat()
+     {
+         String dateFieldFormater = "%m/%d/%y";
+ 
+         if (_messages.contains("format.date.field"))
+             dateFieldFormater = _messages.get("format.date.field");
+ 
+         return dateFieldFormater;
+     }
  
      public FieldValidator getDateFieldValidator()
      {

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

Reply via email to