Home » tapestry-src-5.0.19 » org.apache.tapestry5.corelib.components » [javadoc | source]
org.apache.tapestry5.corelib.components
public class: DateField [javadoc | source]
java.lang.Object
   org.apache.tapestry5.corelib.base.AbstractField
      org.apache.tapestry5.corelib.components.DateField

All Implemented Interfaces:
    Field

A component used to collect a provided date from the user using a client-side JavaScript calendar. Non-JavaScript clients can simply type into a text field.

One wierd aspect here is that, because client-side JavaScript formatting and parsing is so limited, we (currently) use Ajax to send the user's input to the server for parsing (before raising the popup) and formatting (after closing the popup). Wierd and inefficient, but easier than writing client-side JavaScript for that purpose.

Tapestry's DateField component is a wrapper around WebFX DatePicker.
Field Summary
static final  String LOCALIZATION_CONFIGURED_FLAG    Request attribute set to true if localization for the client-side DatePicker has been configured. Used to ensure that this only occurs once, regardless of how many DateFields are on the page. 
Method from org.apache.tapestry5.corelib.components.DateField Summary:
beginRender,   defaultFormat,   defaultValidate,   injectResources,   isRequired,   onFormat,   onParse,   processSubmission
Methods from org.apache.tapestry5.corelib.base.AbstractField:
afterDecorator,   beforeDecorator,   createDefaultParameterBinding,   decorateInsideField,   defaultLabel,   getClientId,   getControlName,   getLabel,   isDisabled,   isRequired,   processSubmission,   setDecorator,   setFormSupport,   setup
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tapestry5.corelib.components.DateField Detail:
  void beginRender(MarkupWriter writer) 
 DateFormat defaultFormat() 
 final Binding defaultValidate() 
  void injectResources(ComponentResources resources) 
 public boolean isRequired() 
 JSONObject onFormat() 
    Ajax event handler, used after the client-side popup completes. The client sends the date, formatted as milliseconds since the epoch, to the server, which reformats it according to the server side format and returns the result.
 JSONObject onParse() 
    Ajax event handler, used when initiating the popup. The client sends the input value form the field to the server to parse it according to the server-side format. The response contains a "result" key of the formatted date in a format acceptable to the JavaScript Date() constructor. Alternately, an "error" key indicates the the input was not formatted correct.
 protected  void processSubmission(String elementName)