Class DateBox.DefaultFormat
java.lang.Object
com.google.gwt.user.datepicker.client.DateBox.DefaultFormat
- All Implemented Interfaces:
DateBox.Format
- Enclosing class:
DateBox
Default
DateBox.Format
class. The date is first parsed using the
DateTimeFormat
supplied by the user, or
DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM
by default.
If that fails, we then try to parse again using the default browser date parsing.
If that fails, thedateBoxFormatError
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.
-
Constructor Summary
ConstructorDescriptionCreates a new default format instance.DefaultFormat
(DateTimeFormat dateTimeFormat) Creates a new default format instance. -
Method Summary
Modifier and TypeMethodDescriptionFormats the provided date.Gets the date time format.Parses the provided string as a date.void
If the format did any modifications to the date box's styling, reset them now.
-
Constructor Details
-
DefaultFormat
public DefaultFormat()Creates a new default format instance. -
DefaultFormat
Creates a new default format instance.- Parameters:
dateTimeFormat
- theDateTimeFormat
to use with thisDateBox.Format
.
-
-
Method Details
-
format
Description copied from interface:DateBox.Format
Formats the provided date. Note, a null date is a possible input.- Specified by:
format
in interfaceDateBox.Format
- Parameters:
box
- the date box you are formattingdate
- the date to format- Returns:
- the formatted date as a string
-
getDateTimeFormat
Gets the date time format.- Returns:
- the date time format
-
parse
Description copied from interface:DateBox.Format
Parses the provided string as a date.- Specified by:
parse
in interfaceDateBox.Format
- Parameters:
dateBox
- the date boxdateText
- the string representing a datereportError
- should the formatter indicate a parse error to the user?- Returns:
- the date created, or null if there was a parse error
-
reset
Description copied from interface:DateBox.Format
If the format did any modifications to the date box's styling, reset them now.- Specified by:
reset
in interfaceDateBox.Format
- Parameters:
dateBox
- the date boxabandon
- true when the current format is being replaced by another
-