|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.smartgwt.client.core.JsObject
com.smartgwt.client.core.DataClass
com.smartgwt.client.core.RefDataClass
com.smartgwt.client.widgets.form.fields.FormItem
com.smartgwt.client.widgets.form.fields.DateItem
public class DateItem
Item for manipulating Dates.
Can be rendered as a text field, or as 3 selects for day, month, year. Includes optional pop-up picker.
Field Summary |
---|
Fields inherited from class com.smartgwt.client.core.JsObject |
---|
jsObj |
Constructor Summary | |
---|---|
DateItem()
|
|
DateItem(com.google.gwt.core.client.JavaScriptObject jsObj)
|
|
DateItem(java.lang.String name)
|
|
DateItem(java.lang.String name,
java.lang.String title)
|
Method Summary | |
---|---|
int |
getCenturyThreshold()
Only used if we're showing the date in a text field. |
DateDisplayFormat |
getDateFormatter()
Inapplicable for DateItems. |
DateDisplayFormat |
getDisplayFormat()
If useTextField is true this property can be used to
customize the format in which dates are displayed.Should be set to a standard DateDisplayFormat or
a function which will return a formatted date string.
Default setting is "toShortDate" which ensures that if the standard
shortDate format is modified via com.smartgwt.client..Date#setShortDisplayFormat this format
will be picked up.
|
java.util.Date |
getEndDate()
Maximum date the selectors will allow the user to pick. |
java.lang.Boolean |
getEnforceDate()
Can this field be set to a non-date value [other than null]? |
java.lang.String |
getInputFormat()
If useTextField is true this property can be used to specify
the input format for date strings. |
java.lang.String |
getInvalidDateStringMessage()
Validation error message to display if the user enters an invalid date |
static DateItem |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
|
java.lang.String |
getPickerIconPrompt()
Prompt to show when the user hovers the mouse over the picker icon for this DateItem. |
java.lang.String |
getSelectorFormat()
If showing date selectors rather than the date text field (so when this.useTextField is false), this property allows customization of the
order of the day, month and year selector fields. |
java.util.Date |
getStartDate()
Minimum date the selectors will allow the user to pick. |
Alignment |
getTextAlign()
If useTextField is true this property governs the alignment
of text within the text field. |
java.lang.Boolean |
getUseTextField()
Should we show the date in a text field, or as 3 select boxes? |
void |
setCenturyThreshold(int centuryThreshold)
Only used if we're showing the date in a text field. |
void |
setDateFormatter(DateDisplayFormat dateFormatter)
Inapplicable for DateItems. |
void |
setDisplayFormat(DateDisplayFormat displayFormat)
If useTextField is true this property can be used to
customize the format in which dates are displayed.Should be set to a standard DateDisplayFormat or
a function which will return a formatted date string.
Default setting is "toShortDate" which ensures that if the standard
shortDate format is modified via com.smartgwt.client..Date#setShortDisplayFormat this format
will be picked up.
|
void |
setEndDate(java.util.Date endDate)
Maximum date the selectors will allow the user to pick. |
void |
setEnforceDate(java.lang.Boolean enforceDate)
Can this field be set to a non-date value [other than null]? |
void |
setInputFormat(java.lang.String inputFormat)
If useTextField is true this property can be used to specify
the input format for date strings. |
void |
setInvalidDateStringMessage(java.lang.String invalidDateStringMessage)
Validation error message to display if the user enters an invalid date |
void |
setPickerIconPrompt(java.lang.String pickerIconPrompt)
Prompt to show when the user hovers the mouse over the picker icon for this DateItem. |
void |
setSelectorFormat(java.lang.String selectorFormat)
If showing date selectors rather than the date text field (so when this.useTextField is false), this property allows customization of the
order of the day, month and year selector fields. |
void |
setStartDate(java.util.Date startDate)
Minimum date the selectors will allow the user to pick. |
void |
setTextAlign(Alignment textAlign)
If useTextField is true this property governs the alignment
of text within the text field. |
void |
setUseTextField(java.lang.Boolean useTextField)
Should we show the date in a text field, or as 3 select boxes? |
Methods inherited from class com.smartgwt.client.core.RefDataClass |
---|
getRef, getRef |
Methods inherited from class com.smartgwt.client.core.DataClass |
---|
doAddHandler, fireEvent, getAttributeAsIntArray, getAttributeAsMap, getAttributeAsObject, getAttributeAsStringArray, getAttributes, getHandlerCount, getJsObj, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute |
Methods inherited from class com.smartgwt.client.core.JsObject |
---|
setJsObj |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Constructor Detail |
---|
public DateItem()
public DateItem(com.google.gwt.core.client.JavaScriptObject jsObj)
public DateItem(java.lang.String name)
public DateItem(java.lang.String name, java.lang.String title)
Method Detail |
---|
public static DateItem getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public void setUseTextField(java.lang.Boolean useTextField)
useTextField
- useTextField Default value is falsepublic java.lang.Boolean getUseTextField()
public void setTextAlign(Alignment textAlign)
useTextField
is true
this property governs the alignment
of text within the text field.
setTextAlign
in class FormItem
textAlign
- textAlign Default value is Canvas.RIGHTpublic Alignment getTextAlign()
useTextField
is true
this property governs the alignment
of text within the text field.
getTextAlign
in class FormItem
public void setEnforceDate(java.lang.Boolean enforceDate)
When set to true, FormItem.setValue(int)
will return false without setting the item value
and log a warning if passed something other than a valid date value.
If a user enters a text value which cannot be parsed into a valid date, the item will
automatically redraw and display the invalidDateStringMessage
(though at this
point calling FormItem.getValue()
will return the string entered by the user).
When set to false, a user may enter value that is not a valid date (for example, "Not applicable") and the value will not immediately be flagged as an error. However note that for the value to actually pass validation you would need to declare the field as not of "date" type, for example:
{name:"startDate", type:"dateOrOther", editorType:"DateItem", useTextField:true },The type "dateOrOther" could be declared as a
SimpleType
, with validators that
will accept either a valid date or certain special Strings (like "Not Available").
Only applies to dateItems where useTextField
is true. Non-Date values
are never supported in items where useTextField is false.
Note : This is an advanced setting
enforceDate
- enforceDate Default value is falsepublic java.lang.Boolean getEnforceDate()
When set to true, FormItem.setValue(int)
will return false without setting the item value
and log a warning if passed something other than a valid date value.
If a user enters a text value which cannot be parsed into a valid date, the item will
automatically redraw and display the invalidDateStringMessage
(though at this
point calling FormItem.getValue()
will return the string entered by the user).
When set to false, a user may enter value that is not a valid date (for example, "Not applicable") and the value will not immediately be flagged as an error. However note that for the value to actually pass validation you would need to declare the field as not of "date" type, for example:
{name:"startDate", type:"dateOrOther", editorType:"DateItem", useTextField:true },The type "dateOrOther" could be declared as a
SimpleType
, with validators that
will accept either a valid date or certain special Strings (like "Not Available").
Only applies to dateItems where useTextField
is true. Non-Date values
are never supported in items where useTextField is false.
public void setInvalidDateStringMessage(java.lang.String invalidDateStringMessage)
invalidDateStringMessage
- invalidDateStringMessage Default value is "Invalid date"public java.lang.String getInvalidDateStringMessage()
public void setPickerIconPrompt(java.lang.String pickerIconPrompt)
pickerIconPrompt
- pickerIconPrompt Default value is "Show Date Chooser"public java.lang.String getPickerIconPrompt()
public void setStartDate(java.util.Date startDate)
startDate
- startDate Default value is 1/1/1995public java.util.Date getStartDate()
public void setEndDate(java.util.Date endDate)
endDate
- endDate Default value is 12/31/2015public java.util.Date getEndDate()
public void setCenturyThreshold(int centuryThreshold)
centuryThreshold
- centuryThreshold Default value is 25public int getCenturyThreshold()
public void setDisplayFormat(DateDisplayFormat displayFormat)
useTextField
is true
this property can be used to
customize the format in which dates are displayed.DateDisplayFormat
or
a function which will return a formatted date string.
Default setting is "toShortDate"
which ensures that if the standard
shortDate format is modified via com.smartgwt.client..Date#setShortDisplayFormat
this format
will be picked up.
NOTE: you may need to update the inputFormat
to ensure the
DateItem is able to parse user-entered date strings back into Dates
displayFormat
- displayFormat Default value is "toShortDate"public DateDisplayFormat getDisplayFormat()
useTextField
is true
this property can be used to
customize the format in which dates are displayed.DateDisplayFormat
or
a function which will return a formatted date string.
Default setting is "toShortDate"
which ensures that if the standard
shortDate format is modified via com.smartgwt.client..Date#setShortDisplayFormat
this format
will be picked up.
NOTE: you may need to update the inputFormat
to ensure the
DateItem is able to parse user-entered date strings back into Dates
public void setInputFormat(java.lang.String inputFormat)
useTextField
is true
this property can be used to specify
the input format for date strings.
If unset, the input format will be determined based on the specified
displayFormat
if possible (see getInputFormat()
), otherwise
picked up from the Date class (see com.smartgwt.client..Date#setInputFormat
).
Should be set to a standard com.smartgwt.client..DateInputFormat
or
a function which will take a date string as a parameter and return a Javascript Date object.
inputFormat
- inputFormat Default value is nullpublic java.lang.String getInputFormat()
useTextField
is true
this property can be used to specify
the input format for date strings.
If unset, the input format will be determined based on the specified
displayFormat
if possible (see getInputFormat()
), otherwise
picked up from the Date class (see com.smartgwt.client..Date#setInputFormat
).
Should be set to a standard com.smartgwt.client..DateInputFormat
or
a function which will take a date string as a parameter and return a Javascript Date object.
useTextField
is true
this method returns a
standard com.smartgwt.client..DateInputFormat
, or parsing function, determining how values entered
by the user are to be converted to Javascript Date objects.
If an explicit inputFormat
has been specified it will be returned.
Otherwise, if an explicit displayFormat
has been specified as one of
toUSShortDate
, toEuropeanShortDate
or toJapanShortDate
this method will return the appropriate DateInputFormat to parse strings entered in the
specified displayFormat.
If no inputFormat can be derived, the method will return null, meaning the standard input
format for Date objects (specified via com.smartgwt.client..Date#setInputFormat
) will be used.
public void setDateFormatter(DateDisplayFormat dateFormatter)
displayFormat
instead.
Note : This is an advanced setting
setDateFormatter
in class FormItem
dateFormatter
- dateFormatter Default value is nullpublic DateDisplayFormat getDateFormatter()
displayFormat
instead.
getDateFormatter
in class FormItem
public void setSelectorFormat(java.lang.String selectorFormat)
this.useTextField
is false), this property allows customization of the
order of the day, month and year selector fields. If unset these fields will match the
specified inputFormat for this item.
selectorFormat
- selectorFormat Default value is nullpublic java.lang.String getSelectorFormat()
this.useTextField
is false), this property allows customization of the
order of the day, month and year selector fields. If unset these fields will match the
specified inputFormat for this item.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |