public static class

DateBox.DefaultFormat

extends Object
implements DateBox.Format
java.lang.Object
   ↳ com.google.gwt.user.datepicker.client.DateBox.DefaultFormat

Class Overview

Default DateBox.Format class. The date is first parsed using the DateTimeFormat supplied by the user, or getMediumDateFormat() by default.

If that fails, we then try to parse again using the default browser date parsing.

If that fails, the dateBoxFormatError css style is applied to the DateBox. The style will be removed when either a successful parse(DateBox, String, boolean) is called or format(DateBox, Date) is called.

Use a different DateBox.Format instance to change that behavior.

Summary

Public Constructors
DateBox.DefaultFormat()
Creates a new default format instance.
DateBox.DefaultFormat(DateTimeFormat dateTimeFormat)
Creates a new default format instance.
Public Methods
String format(DateBox box, Date date)
Formats the provided date.
DateTimeFormat getDateTimeFormat()
Gets the date time format.
Date parse(DateBox dateBox, String dateText, boolean reportError)
Parses the provided string as a date.
void reset(DateBox dateBox, boolean abandon)
If the format did any modifications to the date box's styling, reset them now.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gwt.user.datepicker.client.DateBox.Format

Public Constructors

public DateBox.DefaultFormat ()

Creates a new default format instance.

public DateBox.DefaultFormat (DateTimeFormat dateTimeFormat)

Creates a new default format instance.

Parameters
dateTimeFormat the DateTimeFormat to use with this DateBox.DefaultFormat.

Public Methods

public String format (DateBox box, Date date)

Formats the provided date. Note, a null date is a possible input.

Parameters
box the date box you are formatting
date the date to format
Returns
  • the formatted date as a string

public DateTimeFormat getDateTimeFormat ()

Gets the date time format.

Returns
  • the date time format

public Date parse (DateBox dateBox, String dateText, boolean reportError)

Parses the provided string as a date.

Parameters
dateBox the date box
dateText the string representing a date
reportError should the formatter indicate a parse error to the user?
Returns
  • the date created, or null if there was a parse error

public void reset (DateBox dateBox, boolean abandon)

If the format did any modifications to the date box's styling, reset them now.

Parameters
dateBox the date box
abandon true when the current format is being replaced by another