public static class DateBox.DefaultFormat extends java.lang.Object implements DateBox.Format
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 and Description |
|---|
DefaultFormat()
Creates a new default format instance.
|
DefaultFormat(DateTimeFormat dateTimeFormat)
Creates a new default format instance.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
format(DateBox box,
java.util.Date date)
Formats the provided date.
|
DateTimeFormat |
getDateTimeFormat()
Gets the date time format.
|
java.util.Date |
parse(DateBox dateBox,
java.lang.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.
|
public DefaultFormat()
public DefaultFormat(DateTimeFormat dateTimeFormat)
dateTimeFormat - the DateTimeFormat to use with this
DateBox.Format.public java.lang.String format(DateBox box, java.util.Date date)
DateBox.Formatformat in interface DateBox.Formatbox - the date box you are formattingdate - the date to formatpublic DateTimeFormat getDateTimeFormat()
public java.util.Date parse(DateBox dateBox, java.lang.String dateText, boolean reportError)
DateBox.Formatparse in interface DateBox.FormatdateBox - the date boxdateText - the string representing a datereportError - should the formatter indicate a parse error to the
user?public void reset(DateBox dateBox, boolean abandon)
DateBox.Formatreset in interface DateBox.FormatdateBox - the date boxabandon - true when the current format is being replaced by another