AjaxDatePicker Class Reference

Inherits er::ajax::AjaxComponent.

Collaboration diagram for AjaxDatePicker:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 AjaxDatePicker (WOContext context)
void appendToResponse (WOResponse res, WOContext ctx)
void awake ()
String format ()
Format formatter ()
WOActionResults handleRequest (WORequest request, WOContext context)
boolean isStateless ()
String onClickScript ()
String onFocusScript ()
NSMutableDictionary options ()
void reset ()
String showCalendarScript ()
String translateSimpleDateFormatSymbols (String symbols)
void validationFailedWithException (Throwable t, Object value, String keyPath)

Protected Member Functions

void addRequiredWebResources (WOResponse response)
String cssFileFrameworkName ()
String cssFileName ()

Private Member Functions

void replace (StringBuilder builder, String original, String replacement)

Private Attributes

String format
Format formatter
NSMutableDictionary< String,
String
options

Static Private Attributes

static String defaultImagesDir


Detailed Description

Shameless port and adoption of Rails Date Kit. This input understands the format symbols A, d, e, b, m, B, y, and Y. See the NSTimestampFormatter for what these symbols do. This component can also understand the corresponding symbols from java.text.SimpleDateFormat. The translation from SimpleDateFormat symbols to NSTimestampFormatter symbols may have some defects.

Only one of format or formatter may be bound, if both are unbound the default of m d Y is used. If format is bound, the pattern is used to create an internal formatter for validation. If formatter is bound, its pattern is extracted and used in place of format. The format/formatter is used to control the initial display in the input, the format of the value that the date picker places into the input, and validation of the input contents on form submission. The use of formatter over format is preferred for reasons of efficiency and localization.

NOTE: the AjaxDatePicker does NOT play nice with the AjaxModalDialogOpener. There is some sort of initialization conflict (I think) with Prototype that leaves you with a blank page and the browser waiting forever for something (and I have not been able to determine what it is) as soon as calendar.js loads and initialized. It will work if the page the AMD appears on explicitly loads the calendar.js in it's HEAD:

  public void appendToResponse(WOResponse response, WOContext context) {
       super.appendToResponse(response, context);
       ERXResponseRewriter.addScriptResourceInHead(response, context(), "Ajax", "calendar.js");
   }
 

value the value that will be shown in the input field and set by the date picker (required) format the format to use in the input field (only one of format or formatter may be bound) formatter the formatter to use with the input field (only one of format or formatter may be bound)

id HTML ID passed to the input field class CSS class passed to the input field style CSS style passed to the input field size size attribute passed to the input field maxlength maxlength attribute passed to the input field name name attribute passed to the input field disabled passed to the input field onDateSelect JavaScript to execute when a date is selected from the calendar fireEvent false if the onChange event for the input should NOT be fired when a date is selected in the calendar, defaults to true

dayNames list of day names (Sunday to Saturday) for localization, English is the default monthNames list of month names for localization, English is the default imagesDir directory to take images from, takes them from Ajax.framework by default

calendarCSS name of CSS resource with classed for calendar, defaults to "calendar.css" calendarCSSFramework name of framework (null for application) containing calendarCSS resource, defaults to "Ajax"

See also:
java.text.SimpleDateFormat

com.webobjects.foundation.NSTimestampFormatter

Rails Date Kit

Author:
ported by Chuck Hill

Constructor & Destructor Documentation

AjaxDatePicker ( WOContext  context  ) 


Member Function Documentation

void addRequiredWebResources ( WOResponse  response  )  [protected, virtual]

Includes calendar.css and calendar.js.

Implements AjaxComponent.

void appendToResponse ( WOResponse  res,
WOContext  ctx 
)

Sets up AjaxOptions prior to rendering.

Reimplemented from AjaxComponent.

void awake (  ) 

Sets up format / formatter values.

String cssFileFrameworkName (  )  [protected]

Returns:
value for calendarCSSFramework binding, or default of "Ajax"

String cssFileName (  )  [protected]

Returns:
value for calendarCSS binding, or default of "calendar.css"

String format (  ) 

Returns:
format string used by date picker

Format formatter (  ) 

Returns:
formatter controlling initial contents of input and validation

WOActionResults handleRequest ( WORequest  request,
WOContext  context 
) [virtual]

No action so nothing for us to handle.

Implements AjaxComponent.

boolean isStateless (  ) 

Returns:
true

String onClickScript (  ) 

Returns:
JavaScript for onClick binding of HTML input

String onFocusScript (  ) 

Returns:
JavaScript for onFocus binding of HTML input

Returns:
cached Ajax options for date picker JavaScript

void replace ( StringBuilder  builder,
String  original,
String  replacement 
) [private]

Helper method for translateSimpleDateFormatSymbols.

void reset (  ) 

Clear cached values.

String showCalendarScript (  ) 

Returns:
JavaScript to load CSS and show calendar display

String translateSimpleDateFormatSymbols ( String  symbols  ) 

Quick and rude translation of formatting symbols from SimpleDateFormat to the symbols that this component uses.

Parameters:
symbols the date format symbols to translate
Returns:
translated date format symbols

void validationFailedWithException ( Throwable  t,
Object  value,
String  keyPath 
)

Overridden so that parent will handle in the same manner as if this were a dynamic element.


Member Data Documentation

String defaultImagesDir [static, private]

String format [private]

Format formatter [private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:42:37 2012 for Project Wonder by  doxygen 1.5.8