public class DateItem extends FormItem
Can be rendered as a text field, or as 3 selects for day, month, year. Includes optional pop-up picker.
FormItem.CustomStateGetter, FormItem.StateCustomizer
configOnly, scClassName, warnOnEditorTypeConversion, warnOnEditorTypeConversionDefault
id
factoryCreated, factoryProperties
Constructor and Description |
---|
DateItem() |
DateItem(com.google.gwt.core.client.JavaScriptObject jsObj) |
DateItem(java.lang.String name) |
DateItem(java.lang.String name,
java.lang.String title) |
Modifier and Type | Method and Description |
---|---|
static void |
changeAutoChildDefaults(java.lang.String autoChildName,
Canvas defaults)
Changes the defaults for Canvas AutoChildren named
autoChildName . |
static void |
changeAutoChildDefaults(java.lang.String autoChildName,
FormItem defaults)
Changes the defaults for FormItem AutoChildren named
autoChildName . |
static void |
changePickerIconDefaults(FormItemIcon defaults) |
void |
deselectValue()
If
useTextField is true, falls through to
standard deselectValue() implementation on this
items freeform text entry field. |
void |
deselectValue(java.lang.Boolean start)
If
useTextField is true, falls through to
standard deselectValue() implementation on this
items freeform text entry field. |
java.lang.Boolean |
getAutoUseTextField()
When set to true, the default, and when
useTextField is set to false, such that the item displays multiple separate pickers, useTextField is
automatically switched on when the item is rendering in a non-interactive way, such as when printing, or when canEdit is false and the read-only display-mode is static . |
java.lang.String |
getBrowserInputType()
If
useTextField is true and browserInputType is
set to "date", then a native HTML5 date input is used in place of a text input. |
int |
getCenturyThreshold()
Only used if we're showing the date in a text field.
|
DateDisplayFormat |
getDateFormatter()
If
useTextField is true this
property can be used to customize the format in which dates are displayed for this item.Should be set to a standard DateDisplayFormat . |
SelectItem |
getDaySelector()
Select item to hold the day part of the date.
|
SelectItem |
getDaySelectorProperties()
Custom properties to apply to this dateItem's generated
daySelector . |
java.util.Date |
getDefaultChooserDate()
Default date to show in the date chooser.
|
java.lang.String |
getEditProxyConstructor()
Default class used to construct the
EditProxy for this component when the component is
first placed into edit mode . |
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 |
getEnteredValue()
Returns the raw text value typed into this items text field if
useTextField is true (otherwise returns the result of
this.getValue()). |
FiscalCalendar |
getFiscalCalendar()
Returns the
FiscalCalendar object that will be used by this item's DateChooser. |
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
|
SelectItem |
getMonthSelector()
Select item to hold the month part of the date.
|
SelectItem |
getMonthSelectorProperties()
Custom properties to apply to this dateItem's generated
monthSelector . |
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.
|
DateChooser |
getPickerProperties()
Properties for the
DateChooser created by this form item. |
TimeItem |
getPickerTimeItemProperties()
A set of properties to apply to the
TimeItem displayed in the picker
when showPickerTimeItem is true. |
int[] |
getSelectionRange()
If
useTextField is true, falls through to
standard com.smartgwt.client.widgets.form.fields.FormItem#getSelectionRange implementation on this items
freeform text entry field. |
DateItemSelectorFormat |
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.lang.Boolean |
getShowChooserFiscalYearPicker()
When set to true, show a button that allows the calendar to be navigated by fiscal year.
|
java.lang.Boolean |
getShowChooserWeekPicker()
When set to true, show a button that allows the calendar to be navigated by week or fiscal week, depending on the value
of
showChooserFiscalYearPicker . |
java.lang.Boolean |
getShowHintInField()
If
useTextField is true and a hint is set, should the hint be shown within the field? |
java.lang.Boolean |
getShowPickerTimeItem()
If this field is of type
"datetime" , when showing the DateChooser ,
should the time field be displayed? |
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. |
TextItem |
getTextField()
Text field to hold the entire date in "type in" format, if
useTextField is true. |
TextItem |
getTextFieldProperties()
Custom properties to apply to this dateItem's generated
textField . |
java.lang.Boolean |
getUse24HourTime()
When showing the
DateChooser and the field is of type "datetime", whether the time field should be set to use 24-hour time. |
boolean |
getUsePlaceholderForHint()
If
showing the hint in field and if
supported by the browser, should the HTML5
placeholder attribute
be used to display the hint within the field? If set to false , then use of
the placeholder attribute is disabled and an alternative technique to display
the hint in-field is used instead. |
java.lang.Boolean |
getUseSharedPicker()
When set to true (the default), use a single shared date-picker across all widgets that use one.
|
java.lang.Boolean |
getUseTextField()
When set to true, the item uses a
single text
field for working with the item's value. |
java.util.Date |
getValueAsDate()
Return the value tracked by this form item.
|
java.lang.Boolean |
getWrapHintText()
If this item is showing a
FormItem.hint , should the
hint text be allowed to wrap? Setting this property to false will render the hint on a single line without
wrapping, expanding the width required to render the item if necessary. |
SelectItem |
getYearSelector()
Select item to hold the year part of the date.
|
SelectItem |
getYearSelectorProperties()
Custom properties to apply to this dateItem's generated
yearSelector . |
boolean |
pendingStatusChanged(DynamicForm form,
FormItem item,
boolean pendingStatus,
java.lang.Object newValue,
java.lang.Object value)
Notification method called when
showPending is
enabled and this date item should either clear or show its pending visual state. |
void |
selectValue()
If
useTextField is true, falls through to
standard selectValue() implementation on this items
freeform text entry field. |
void |
setAutoUseTextField(java.lang.Boolean autoUseTextField)
When set to true, the default, and when
useTextField is set to false, such that the item displays multiple separate pickers, useTextField is
automatically switched on when the item is rendering in a non-interactive way, such as when printing, or when canEdit is false and the read-only display-mode is static . |
void |
setBrowserInputType(java.lang.String browserInputType)
If
useTextField is true and browserInputType is
set to "date", then a native HTML5 date input is used in place of a text input. |
void |
setCenturyThreshold(int centuryThreshold)
Only used if we're showing the date in a text field.
|
void |
setDateFormatter(DateDisplayFormat dateFormatter)
If
useTextField is true this
property can be used to customize the format in which dates are displayed for this item.Should be set to a standard DateDisplayFormat . |
void |
setDaySelectorProperties(SelectItem daySelectorProperties)
Custom properties to apply to this dateItem's generated
daySelector . |
void |
setDefaultChooserDate(java.util.Date defaultChooserDate)
Default date to show in the date chooser.
|
static void |
setDefaultProperties(DateItem dateItemProperties)
Class level method to set the default properties of this class.
|
void |
setEditorValueFormatter(FormItemValueFormatter formatter)
An optional
FormItemValueFormatter to map this item's current data
value to a display value. |
void |
setEditorValueParser(FormItemValueParser valueParser)
An optional
FormItemValueParser to map a user-entered display value to a data
value for storage. |
void |
setEditProxyConstructor(java.lang.String editProxyConstructor)
Default class used to construct the
EditProxy for this component when the component is
first placed into edit mode . |
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 |
setFiscalCalendar()
Sets the
FiscalCalendar object that will be used by this item's DateChooser. |
void |
setFiscalCalendar(FiscalCalendar fiscalCalendar)
Sets the
FiscalCalendar object that will be used by this item's DateChooser. |
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 |
setMaskDateSeparator(java.lang.String maskDateSeparator)
|
void |
setMonthSelectorProperties(SelectItem monthSelectorProperties)
Custom properties to apply to this dateItem's generated
monthSelector . |
void |
setPickerIconPrompt(java.lang.String pickerIconPrompt)
Prompt to show when the user hovers the mouse over the picker icon for this DateItem.
|
void |
setPickerProperties(DateChooser pickerProperties)
Properties for the
DateChooser created by this form item. |
void |
setPickerTimeItemProperties(TimeItem pickerTimeItemProperties)
A set of properties to apply to the
TimeItem displayed in the picker
when showPickerTimeItem is true. |
void |
setSelectionRange(int start,
int end)
If
useTextField is true, falls through to
standard setSelectionRange() implementation
on this items freeform text entry field. |
void |
setSelectorFormat(DateItemSelectorFormat 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 |
setShowChooserFiscalYearPicker(java.lang.Boolean showChooserFiscalYearPicker)
When set to true, show a button that allows the calendar to be navigated by fiscal year.
|
void |
setShowChooserWeekPicker(java.lang.Boolean showChooserWeekPicker)
When set to true, show a button that allows the calendar to be navigated by week or fiscal week, depending on the value
of
showChooserFiscalYearPicker . |
void |
setShowHintInField(java.lang.Boolean showHintInField)
If
useTextField is true and a hint is set, should the hint be shown within the field? |
void |
setShowPickerTimeItem(java.lang.Boolean showPickerTimeItem)
If this field is of type
"datetime" , when showing the DateChooser ,
should the time field be displayed? |
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 |
setTextFieldProperties(TextItem textFieldProperties)
Custom properties to apply to this dateItem's generated
textField . |
void |
setUse24HourTime(java.lang.Boolean use24HourTime)
When showing the
DateChooser and the field is of type "datetime", whether the time field should be set to use 24-hour time. |
void |
setUseMask(java.lang.Boolean useMask)
If
useTextField is not false this
property determines if an input mask should be used. |
void |
setUsePlaceholderForHint(boolean usePlaceholderForHint)
If
showing the hint in field and if
supported by the browser, should the HTML5
placeholder attribute
be used to display the hint within the field? If set to false , then use of
the placeholder attribute is disabled and an alternative technique to display
the hint in-field is used instead. |
void |
setUseSharedPicker(java.lang.Boolean useSharedPicker)
When set to true (the default), use a single shared date-picker across all widgets that use one.
|
void |
setUseTextField(java.lang.Boolean useTextField)
When set to true, the item uses a
single text
field for working with the item's value. |
void |
setWrapHintText(java.lang.Boolean wrapHintText)
If this item is showing a
FormItem.hint , should the
hint text be allowed to wrap? Setting this property to false will render the hint on a single line without
wrapping, expanding the width required to render the item if necessary. |
void |
setYearSelectorProperties(SelectItem yearSelectorProperties)
Custom properties to apply to this dateItem's generated
yearSelector . |
_getValue, addBlurHandler, addChangedHandler, addChangeHandler, addClickHandler, addDoubleClickHandler, addEditorEnterHandler, addEditorExitHandler, addFocusHandler, addIcon, addIcon, addIconClickHandler, addIconKeyPressHandler, addItemHoverHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addPendingStatusChangedHandler, addPickerIconClickHandler, addShowContextMenuHandler, addTitleClickHandler, addTitleDoubleClickHandler, addTitleHoverHandler, addValueHoverHandler, addValueIconClickHandler, applyFormula, asSGWTComponent, blurItem, canEditCriterion, clearErrors, clearValue, disable, disableIcon, enable, enableIcon, error, error, errorIfNotCreated, focusAfterItem, focusInItem, getAccessKey, getAlign, getAllowExpressions, getAlwaysFetchMissingValues, getAlwaysShowControlBox, getApplyAlignToText, getApplyHeightToTextBox, getAriaRole, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsObject, getAttributeAsString, getAutoComplete, getAutoCompleteKeywords, getBrowserSpellCheck, getCanEdit, getCanEditOpaqueValues, getCanFocus, getCanSelectText, getCanTabToIcons, getCanvasAutoChild, getCellHeight, getCellStyle, getChangeOnKeypress, getClassName, getClipStaticValue, getClipTitle, getConfig, getContainerWidget, getControlStyle, getCriteriaField, getCriterion, getCriterion, getCursorPosition, getCustomState, getDataPath, getDecimalPad, getDecimalPrecision, getDefaultIconSrc, getDisabled, getDisableIconsOnReadOnly, getDisplayField, getDisplayFieldName, getDisplayValue, getDisplayValue, getEditorTypeConfig, getEditPendingCSSText, getEmptyDisplayValue, getEmptyValueIcon, getEndRow, getErrorIconHeight, getErrorIconSrc, getErrorIconWidth, getErrorMessageWidth, getErrors, getExportFormat, getFetchMissingValues, getFieldName, getFilterLocally, getForeignDisplayField, getForm, getFormat, getFormItemAutoChild, getFormula, getFullDataPath, getGlobalTabIndex, getGridColNum, getGridRowNum, getHeight, getHeightAsString, getHidden, getHint, getHintStyle, getHoverAlign, getHoverDelay, getHoverHeight, getHoverOpacity, getHoverStyle, getHoverVAlign, getHoverWidth, getIcon, getIconHeight, getIconHSpace, getIconPageRect, getIconPrompt, getIconRect, getIcons, getIconTabPosition, getIconVAlign, getIconWidth, getID, getImageURLPrefix, getImageURLSuffix, getImplicitSave, getImplicitSaveOnBlur, getLeft, getListGrid, getLoadingDisplayValue, getLocateItemBy, getMinHintWidth, getMultiple, getMultipleValueSeparator, getName, getOperator, getOptionCriteria, getOptionDataSource, getOptionDataSourceAsString, getOptionFilterContext, getOptionOperationId, getOriginalValueMessage, getPageLeft, getPageRect, getPageTop, getPaletteDefaults, getPicker, getPickerIcon, getPickerIcon, getPickerIconHeight, getPickerIconName, getPickerIconProperties, getPickerIconSrc, getPickerIconStyle, getPickerIconTabPosition, getPickerIconWidth, getPixelHeight, getPixelWidth, getPrintTextBoxStyle, getPrintTitleStyle, getPrompt, getReadOnlyDisplay, getReadOnlyHover, getReadOnlyTextBoxStyle, getReadOnlyWhen, getRect, getRedrawOnChange, getRejectInvalidValueOnChange, getRequired, getRequiredMessage, getRequiredWhen, getRowSpan, getSaveOnEnter, getScClassName, getSelectedRecord, getSelectOnClick, getSelectOnFocus, getShouldSaveValue, getShowClippedTitleOnHover, getShowClippedValueOnHover, getShowDeletions, getShowDisabled, getShowDisabledIconsOnFocus, getShowDisabledPickerIconOnFocus, getShowErrorIcon, getShowErrorStyle, getShowErrorText, getShowFocused, getShowFocusedErrorState, getShowFocusedIcons, getShowFocusedPickerIcon, getShowHint, getShowIcons, getShowIconsOnFocus, getShowOldValueInHover, getShowOver, getShowOverIcons, getShowPending, getShowPickerIcon, getShowPickerIconOnFocus, getShowRTL, getShowTitle, getShowValueIconOnly, getStartRow, getStaticHeight, getStopOnError, getSupportsCutPasteEvents, getSuppressValueIcon, getSynchronousValidation, getTabIndex, getTextBoxStyle, getTextFormula, getTimeFormatter, getTitle, getTitleAlign, getTitleColSpan, getTitleOrientation, getTitleStyle, getTitleVAlign, getTooltip, getTop, getType, getUpdateControlOnOver, getUpdatePickerIconOnOver, getUpdateTextBoxOnOver, getUseAdvancedCriteria, getUseDisabledHintStyleForReadOnly, getUseLocalDisplayFieldValue, getValidateOnChange, getValidateOnExit, getValidOperators, getVAlign, getValue, getValueAsRecordList, getValueDeselectedCSSText, getValueField, getValueFieldName, getValueIconHeight, getValueIconLeftPadding, getValueIconRightPadding, getValueIconSize, getValueIconWidth, getValueMap, getValueMapAsArray, getVisible, getVisibleHeight, getVisibleTitleWidth, getVisibleWhen, getVisibleWidth, getWarnOnEditorTypeConversion, getWarnOnEditorTypeConversionDefault, getWidth, getWidthAsString, getWrapTitle, handleWarnOnEditorTypeConversion, hasAdvancedCriteria, hasErrors, hide, hideIcon, invalidateDisplayValueCache, isConfigOnly, isCreated, isCutEvent, isDisabled, isDrawn, isFocused, isInGrid, isPasteEvent, isVisible, linkToInstanceUponCreate, mapDisplayToValue, mapValueToDisplay, mapValueToDisplay, mapValueToDisplay, redraw, redraw, removeIcon, setAccessKey, setAlign, setAllowExpressions, setAlwaysFetchMissingValues, setAlwaysShowControlBox, setApplyAlignToText, setApplyHeightToTextBox, setAriaRole, setAriaState, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoChildConstructor, setAutoChildProperties, setAutoChildProperties, setAutoChildProperties, setAutoChildVisibility, setAutoComplete, setAutoCompleteKeywords, setBrowserSpellCheck, setCanEdit, setCanEditCriterionPredicate, setCanEditOpaqueValues, setCanFocus, setCanSelectText, setCanTabToIcons, setCellHeight, setCellStyle, setChangeOnKeypress, setClipStaticValue, setClipTitle, setColSpan, setColSpan, setConfigOnly, setControlStyle, setCriteriaField, setCriterion, setCriterionGetter, setCriterionSetter, setCustomStateGetter, setDataPath, setDecimalPad, setDecimalPrecision, setDefaultIconSrc, setDefaultProperties, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDisabled, setDisableIconsOnReadOnly, setDisplayField, setDisplayFormat, setDisplayFormat, setEditorProperties, setEditorType, setEditorType, setEditorType, setEditPendingCSSText, setEmptyDisplayValue, setEmptyValueIcon, setEndRow, setErrorFormatter, setErrorIconHeight, setErrorIconSrc, setErrorIconWidth, setErrorMessageWidth, setErrorOrientation, setErrors, setErrors, setExportFormat, setFetchMissingValues, setFilterLocally, setForeignDisplayField, setFormat, setFormula, setGlobalTabIndex, setHeight, setHeight, setHidden, setHint, setHintStyle, setHoverAlign, setHoverDelay, setHoverHeight, setHoverOpacity, setHoverStyle, setHoverVAlign, setHoverWidth, setIconDisabled, setIconHeight, setIconHSpace, setIconPrompt, setIcons, setIconShowOnFocus, setIconVAlign, setIconWidth, setID, setImageURLPrefix, setImageURLSuffix, setImplicitSave, setImplicitSaveOnBlur, setInitHandler, setInputTransformer, setItemHoverFormatter, setItemTitleHoverFormatter, setItemValueHoverFormatter, setJavaScriptObject, setLeft, setLoadingDisplayValue, setLocateItemBy, setMinHintWidth, setMultiple, setMultipleValueSeparator, setName, setNullProperty, setOperator, setOptionCriteria, setOptionDataSource, setOptionDataSource, setOptionFilterContext, setOptionOperationId, setOriginalValueMessage, setPickerIconHeight, setPickerIconName, setPickerIconProperties, setPickerIconSrc, setPickerIconStyle, setPickerIconWidth, setPrintTextBoxStyle, setPrintTitleStyle, setPrompt, setProperty, setProperty, setProperty, setProperty, setProperty, setReadOnlyDisplay, setReadOnlyHover, setReadOnlyTextBoxStyle, setReadOnlyWhen, setRedrawOnChange, setRejectInvalidValueOnChange, setRequired, setRequiredMessage, setRequiredWhen, setRowSpan, setSaveOnEnter, setScClassName, setSelectOnClick, setSelectOnFocus, setShouldSaveValue, setShowClippedTitleOnHover, setShowClippedValueOnHover, setShowDeletions, setShowDisabled, setShowDisabledIconsOnFocus, setShowDisabledPickerIconOnFocus, setShowErrorIcon, setShowErrorStyle, setShowErrorText, setShowFocused, setShowFocusedErrorState, setShowFocusedIcons, setShowFocusedPickerIcon, setShowHint, setShowIcons, setShowIconsOnFocus, setShowIfCondition, setShowOldValueInHover, setShowOver, setShowOverIcons, setShowPending, setShowPickerIcon, setShowPickerIconOnFocus, setShowRTL, setShowTitle, setShowValueIconOnly, setStartRow, setStateCustomizer, setStaticHeight, setStopOnError, setSupportsCutPasteEvents, setSuppressValueIcon, setSynchronousValidation, setTabIndex, setTextBoxStyle, setTextFormula, setTimeFormatter, setTitle, setTitleAlign, setTitleColSpan, setTitleHoverFormatter, setTitleOrientation, setTitleStyle, setTitleVAlign, setTooltip, setTop, setType, setUpdateControlOnOver, setUpdatePickerIconOnOver, setUpdateTextBoxOnOver, setUseAdvancedCriteria, setUseDisabledHintStyleForReadOnly, setUseLocalDisplayFieldValue, setValidateOnChange, setValidateOnExit, setValidators, setValidOperators, setVAlign, setValue, setValue, setValue, setValue, setValue, setValue, setValueDeselectedCSSText, setValueField, setValueFormatter, setValueHoverFormatter, setValueIconHeight, setValueIconLeftPadding, setValueIconMapper, setValueIconRightPadding, setValueIcons, setValueIconSize, setValueIconWidth, setValueMap, setValueMap, setVisible, setVisibleWhen, setWarnOnEditorTypeConversion, setWarnOnEditorTypeConversionDefault, setWidth, setWidth, setWrapTitle, shouldApplyHeightToTextBox, shouldFetchMissingValue, shouldSaveOnEnter, shouldStopKeyPressBubbling, show, showIcon, showPicker, stopHover, storeValue, storeValue, updateState, validate, valueClipped
getRef, getRef, internalSetID
applyFactoryProperties, doAddHandler, fireEvent, getAttributeAsDoubleArray, getAttributeAsIntArray, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated
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)
public static DateItem getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public static void changeAutoChildDefaults(java.lang.String autoChildName, Canvas defaults)
autoChildName
.autoChildName
- name of an AutoChild to customize the defaults for.defaults
- Canvas defaults to apply. These defaults override any existing properties
without destroying or wiping out non-overridden properties. For usage tips on this
param, see SGWTProperties
.AutoChildUsage
public static void changeAutoChildDefaults(java.lang.String autoChildName, FormItem defaults)
autoChildName
.autoChildName
- name of an AutoChild to customize the defaults for.defaults
- FormItem defaults to apply. These defaults override any existing properties
without destroying or wiping out non-overridden properties. For usage tips on this
param, see SGWTProperties
.AutoChildUsage
public static void changePickerIconDefaults(FormItemIcon defaults)
public void setAutoUseTextField(java.lang.Boolean autoUseTextField)
useTextField
is set to false, such that the item displays multiple separate pickers, useTextField
is
automatically switched on when the item is rendering in a non-interactive way, such as when printing, or when canEdit
is false and the read-only display-mode is static
.autoUseTextField
- New autoUseTextField value. Default value is trueBasics overview and related methods
public java.lang.Boolean getAutoUseTextField()
useTextField
is set to false, such that the item displays multiple separate pickers, useTextField
is
automatically switched on when the item is rendering in a non-interactive way, such as when printing, or when canEdit
is false and the read-only display-mode is static
.Basics overview and related methods
public void setBrowserInputType(java.lang.String browserInputType)
useTextField
is true and browserInputType is
set to "date", then a native HTML5 date input is used in place of a text input. The use of a native HTML5 date input causes
certain features to be disabled. Input masks, the picker icon, and a custom dateFormatter
are not supported. In-field hints
are currently supported, but future
browser changes might force this support to be removed. Therefore, it is safest to not use in-field hints (set
showHintInField to false) in conjunction with a native HTML5 date input.
NOTE: For optimal appearance this feature requires specific CSS which may not be present in certain legacy skins.
Note : This is an advanced setting
setBrowserInputType
in class FormItem
browserInputType
- New browserInputType value. Default value is nullpublic java.lang.String getBrowserInputType()
useTextField
is true and browserInputType is
set to "date", then a native HTML5 date input is used in place of a text input. The use of a native HTML5 date input causes
certain features to be disabled. Input masks, the picker icon, and a custom dateFormatter
are not supported. In-field hints
are currently supported, but future
browser changes might force this support to be removed. Therefore, it is safest to not use in-field hints (set
showHintInField to false) in conjunction with a native HTML5 date input.
NOTE: For optimal appearance this feature requires specific CSS which may not be present in certain legacy skins.
getBrowserInputType
in class FormItem
public void setCenturyThreshold(int centuryThreshold)
If you need to allow 1 and 2 digit years,
set this attribute to null
to have the control retain your year-value as entered.
centuryThreshold
- New centuryThreshold value. Default value is 25Appearance overview and related methods
public int getCenturyThreshold()
If you need to allow 1 and 2 digit years,
set this attribute to null
to have the control retain your year-value as entered.
Appearance overview and related methods
public void setDateFormatter(DateDisplayFormat dateFormatter)
useTextField
is true
this
property can be used to customize the format in which dates are displayed for this item.DateDisplayFormat
. As with any formItem rendering out a date value, if no
explicit dateFormatter is supplied, dateFormatter will be derived from DynamicForm.dateFormatter
or DynamicForm.datetimeFormatter
, depending on the
specified FormItem.type
for this field, if set,
otherwise from the standard default DateUtil.setShortDisplayFormat()
or DateUtil.setShortDatetimeDisplayFormat()
.
NOTE: For entirely custom formats, developers may apply a custom
editorValueFormatter
. To ensure the DateItem is able to parse user-entered date strings back into Dates,
for most cases developers can specify an explicit inputFormat
, or if necessary a custom editorValueParser
This attribute does not have an effect if a
native HTML5 date or datetime input is being used. See browserInputType
.
setDateFormatter
in class FormItem
dateFormatter
- New dateFormatter value. Default value is nullFormItem.setTimeFormatter(com.smartgwt.client.types.TimeDisplayFormat)
,
FormItem.setFormat(java.lang.String)
,
Appearance overview and related methods
public DateDisplayFormat getDateFormatter()
useTextField
is true
this
property can be used to customize the format in which dates are displayed for this item.DateDisplayFormat
. As with any formItem rendering out a date value, if no
explicit dateFormatter is supplied, dateFormatter will be derived from DynamicForm.dateFormatter
or DynamicForm.datetimeFormatter
, depending on the
specified FormItem.type
for this field, if set,
otherwise from the standard default DateUtil.setShortDisplayFormat()
or DateUtil.setShortDatetimeDisplayFormat()
.
NOTE: For entirely custom formats, developers may apply a custom
editorValueFormatter
. To ensure the DateItem is able to parse user-entered date strings back into Dates,
for most cases developers can specify an explicit inputFormat
, or if necessary a custom editorValueParser
This attribute does not have an effect if a
native HTML5 date or datetime input is being used. See browserInputType
.
getDateFormatter
in class FormItem
FormItem.getTimeFormatter()
,
FormItem.getFormat()
,
Appearance overview and related methods
public SelectItem getDaySelector()
This component is an AutoChild named "daySelector". For an overview of how to use and
configure AutoChildren, see Using AutoChildren
.
getSelectorFormat()
public void setDaySelectorProperties(SelectItem daySelectorProperties)
daySelector
.
Note : This is an advanced setting
daySelectorProperties
- New daySelectorProperties value. Default value is nullpublic SelectItem getDaySelectorProperties()
daySelector
.public void setDefaultChooserDate(java.util.Date defaultChooserDate)
defaultChooserDate
- New defaultChooserDate value. Default value is nullpublic java.util.Date getDefaultChooserDate()
Default
implementation returns defaultChooserDate
. Default value is null
public void setEditProxyConstructor(java.lang.String editProxyConstructor)
EditProxy
for this component when the component is
first placed into edit mode
.setEditProxyConstructor
in class FormItem
editProxyConstructor
- New editProxyConstructor value. Default value is "DateItemEditProxy"SCClassName
public java.lang.String getEditProxyConstructor()
EditProxy
for this component when the component is
first placed into edit mode
.getEditProxyConstructor
in class FormItem
SCClassName
public void setEndDate(java.util.Date endDate)
See startDate
for details on how this
restriction works.
If this method is called after the component has been drawn/initialized:
Setter for endDate
.
Note: A LogicalDate
is expected.
endDate
- the new endDate. Default value is See belowAppearance overview and related methods
public java.util.Date getEndDate()
See startDate
for details on how this
restriction works.
Appearance overview and related methods
public void setEnforceDate(java.lang.Boolean enforceDate)
When set to true, FormItem.setValue()
will return
false without setting the item value
and log a warning if passed something other than a valid date value.
If the dateItem is showing a free-form text
entry field
,
and 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 a 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.
This attribute does not have an effect if a native HTML5 date input is being used.
See browserInputType
.
Note : This is an advanced setting
enforceDate
- New enforceDate value. Default value is falsepublic java.lang.Boolean getEnforceDate()
When set to true, FormItem.setValue()
will return
false without setting the item value
and log a warning if passed something other than a valid date value.
If the dateItem is showing a free-form text
entry field
,
and 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 a 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.
This attribute does not have an effect if a native HTML5 date input is being used.
See browserInputType
.
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 dateFormatter
if possible
(see getInputFormat()
), otherwise picked up from
the Date class (see DateUtil.setInputFormat()
). Should be
set to a standard DateInputFormat
Note that the DateInputFormat
property is sufficient to parse date or datetime strings specified in most
standard date formats. However should an entirely custom parsing function be required developers can apply a custom
editorValueParser
function.
This attribute does not have an effect if a native HTML5 date input is
being used. See browserInputType
.
setInputFormat
in class FormItem
inputFormat
- New inputFormat value. Default value is nullFormItem.setDisplayFormat(com.smartgwt.client.types.DateDisplayFormat)
,
DateInputFormat
public 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 dateFormatter
if possible
(see getInputFormat()
), otherwise picked up from
the Date class (see DateUtil.setInputFormat()
). Should be
set to a standard DateInputFormat
Note that the DateInputFormat
property is sufficient to parse date or datetime strings specified in most
standard date formats. However should an entirely custom parsing function be required developers can apply a custom
editorValueParser
function.
This attribute does not have an effect if a native HTML5 date input is
being used. See browserInputType
.
getInputFormat
in class FormItem
useTextField
is true
this
method returns a standard DateInputFormat
, 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 a custom dateFormatter
or format
are specified, the input format will be automatically
derived from that property.
Otherwise, the global inputFormat
is used.
Note that the inputFormat will ignore any separator characters and padding of values. However
if necessary entirely custom date formatting and parsing may be achieved via the setEditorValueFormatter()
and setEditorValueParser()
APIs. Default value is null
com.smartgwt.client.widgets.form.fields.DateItem#getDisplayFormat
,
DateInputFormat
public void setInvalidDateStringMessage(java.lang.String invalidDateStringMessage)
invalidDateStringMessage
- New invalidDateStringMessage value. Default value is "Invalid date"public java.lang.String getInvalidDateStringMessage()
public void setMaskDateSeparator(java.lang.String maskDateSeparator)
useTextField
and useMask
are both true
this value is the
separator between date components. If unset DateUtil.getDefaultDateSeparator()
will be used.
Note : This is an advanced setting
maskDateSeparator
- New maskDateSeparator value. Default value is nullBasics overview and related methods
public SelectItem getMonthSelector()
This component is an AutoChild named "monthSelector". For an overview of how to use and
configure AutoChildren, see Using AutoChildren
.
getSelectorFormat()
public void setMonthSelectorProperties(SelectItem monthSelectorProperties)
monthSelector
.
Note : This is an advanced setting
monthSelectorProperties
- New monthSelectorProperties value. Default value is nullpublic SelectItem getMonthSelectorProperties()
monthSelector
.public void setPickerIconPrompt(java.lang.String pickerIconPrompt)
setPickerIconPrompt
in class FormItem
pickerIconPrompt
- New pickerIconPrompt value. Default value is "Show Date Chooser"HTMLString
public java.lang.String getPickerIconPrompt()
getPickerIconPrompt
in class FormItem
HTMLString
public void setPickerProperties(DateChooser pickerProperties)
DateChooser
created by this form item.pickerProperties
- New pickerProperties value. Default value is see belowSGWTProperties
public DateChooser getPickerProperties()
DateChooser
created by this form item.public void setPickerTimeItemProperties(TimeItem pickerTimeItemProperties)
TimeItem
displayed in the picker
when showPickerTimeItem
is true. Has
no effect for fields of type "date"
.
Note : This is an advanced setting
pickerTimeItemProperties
- New pickerTimeItemProperties value. Default value is nullpublic TimeItem getPickerTimeItemProperties()
TimeItem
displayed in the picker
when showPickerTimeItem
is true. Has
no effect for fields of type "date"
.
public void setSelectorFormat(DateItemSelectorFormat 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,
but note that the attribute default will likely be set by localization
to a valid
DateItemSelectorFormat
. Note: selectors may be omitted entirely by setting
selectorFormat to (for example) "MD"
. In this case the value for the omitted selector will match the
defaultValue
specified for the item. For
example, if the selector format is "MD" (month and day only), the year comes from the Date specified as the
defaultValue.
selectorFormat
- New selectorFormat value. Default value is variescom.smartgwt.client.widgets.form.fields.DateItem#setDaySelector
,
com.smartgwt.client.widgets.form.fields.DateItem#setMonthSelector
,
com.smartgwt.client.widgets.form.fields.DateItem#setYearSelector
public DateItemSelectorFormat 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,
but note that the attribute default will likely be set by localization
to a valid
DateItemSelectorFormat
. Note: selectors may be omitted entirely by setting
selectorFormat to (for example) "MD"
. In this case the value for the omitted selector will match the
defaultValue
specified for the item. For
example, if the selector format is "MD" (month and day only), the year comes from the Date specified as the
defaultValue.
getDaySelector()
,
getMonthSelector()
,
getYearSelector()
public void setShowChooserFiscalYearPicker(java.lang.Boolean showChooserFiscalYearPicker)
showChooserFiscalYearPicker
- New showChooserFiscalYearPicker value. Default value is falsepublic java.lang.Boolean getShowChooserFiscalYearPicker()
public void setShowChooserWeekPicker(java.lang.Boolean showChooserWeekPicker)
showChooserFiscalYearPicker
.showChooserWeekPicker
- New showChooserWeekPicker value. Default value is falsepublic java.lang.Boolean getShowChooserWeekPicker()
showChooserFiscalYearPicker
.public void setShowHintInField(java.lang.Boolean showHintInField)
useTextField
is true and a hint
is set, should the hint be shown within the field?
Note that when using a native HTML5 date input (see browserInputType
), in-field hints are currently
supported, but future browser changes might not allow in-field hints to be supported. Therefore, it is safest to
not use in-field hints in conjunction with a native HTML5 date input.
To change this attribute after being
drawn, it is necessary to call FormItem.redraw()
or
redraw the form.
Note : This is an advanced setting
showHintInField
- New showHintInField value. Default value is nullFormItem.setHint(java.lang.String)
,
setUsePlaceholderForHint(boolean)
,
Appearance overview and related methods
public java.lang.Boolean getShowHintInField()
useTextField
is true and a hint
is set, should the hint be shown within the field?
Note that when using a native HTML5 date input (see browserInputType
), in-field hints are currently
supported, but future browser changes might not allow in-field hints to be supported. Therefore, it is safest to
not use in-field hints in conjunction with a native HTML5 date input.
To change this attribute after being
drawn, it is necessary to call FormItem.redraw()
or
redraw the form.
FormItem.getHint()
,
getUsePlaceholderForHint()
,
Appearance overview and related methods
public void setShowPickerTimeItem(java.lang.Boolean showPickerTimeItem)
"datetime"
, when showing the DateChooser
,
should the time field
be displayed? Has no effect
for fields of type "date"
.
This attribute does not have an effect if a native HTML5 date input is being
used. See browserInputType
.
showPickerTimeItem
- New showPickerTimeItem value. Default value is truepublic java.lang.Boolean getShowPickerTimeItem()
"datetime"
, when showing the DateChooser
,
should the time field
be displayed? Has no effect
for fields of type "date"
.
This attribute does not have an effect if a native HTML5 date input is being
used. See browserInputType
.
public void setStartDate(java.util.Date startDate)
NOTE: by design, setting startDate
and endDate
will not always prevent the
user from picking invalid values. In particular:
This is by design as it allows the user to set the day, month and year in whatever order is convenient, rather than forcing them to pick in a specific order.
For actual enforcement
of a date being in correct range before data is submitted, a Validator
of type "dateRange" should always be declared.
If this method is called after the component has been drawn/initialized:
Setter for startDate
.
Note: A LogicalDate
is expected.
startDate
- the new startDate. Default value is See belowAppearance overview and related methods
public java.util.Date getStartDate()
NOTE: by design, setting startDate
and endDate
will not always prevent the
user from picking invalid values. In particular:
This is by design as it allows the user to set the day, month and year in whatever order is convenient, rather than forcing them to pick in a specific order.
For actual enforcement
of a date being in correct range before data is submitted, a Validator
of type "dateRange" should always be declared.
Appearance overview and related methods
public void setTextAlign(Alignment textAlign)
useTextField
is true
this
property governs the alignment of text within the text field. Defaults to "right"
by default or
"left"
if the page is in rtl mode
. This attribute does not
have an effect if a native HTML5 date input is being used. See browserInputType
.
setTextAlign
in class FormItem
textAlign
- New textAlign value. Default value is variesAppearance overview and related methods
public Alignment getTextAlign()
useTextField
is true
this
property governs the alignment of text within the text field. Defaults to "right"
by default or
"left"
if the page is in rtl mode
. This attribute does not
have an effect if a native HTML5 date input is being used. See browserInputType
.
getTextAlign
in class FormItem
Appearance overview and related methods
public TextItem getTextField()
useTextField
is true.
This component is an AutoChild named "textField". For an overview of how to use and
configure AutoChildren, see Using AutoChildren
.
public void setTextFieldProperties(TextItem textFieldProperties)
textField
. Only applies if useTextField
is true.
Note : This is an advanced setting
textFieldProperties
- New textFieldProperties value. Default value is nullpublic TextItem getTextFieldProperties()
textField
. Only applies if useTextField
is true.public void setUse24HourTime(java.lang.Boolean use24HourTime)
DateChooser
and the field is of type "datetime", whether the time field
should be set to use 24-hour time. The default is
true. Has no effect if showPickerTimeItem
is explicitly set to false
.
use24HourTime
- New use24HourTime value. Default value is truepublic java.lang.Boolean getUse24HourTime()
DateChooser
and the field is of type "datetime", whether the time field
should be set to use 24-hour time. The default is
true. Has no effect if showPickerTimeItem
is explicitly set to false
.
public void setUseMask(java.lang.Boolean useMask)
useTextField
is not false
this
property determines if an input mask should be used. The format of the mask is determined by the inputFormat
or dateFormatter
(in that order). This attribute
does not have an effect if a native HTML5 date input is being used. See browserInputType
.
Note : This is an advanced setting
useMask
- New useMask value. Default value is nullsetMaskDateSeparator(java.lang.String)
,
Basics overview and related methods
public void setUsePlaceholderForHint(boolean usePlaceholderForHint)
showing the hint in field
and if
supported by the browser, should the HTML5
placeholder
attribute
be used to display the hint within the field? If set to false
, then use of
the placeholder
attribute is disabled and an alternative technique to display
the hint in-field is used instead.
The HTML5 placeholder
attribute is supported in the following major browsers:
WebView
(used by the stock Browser app and when
packaging with PhoneGap
)In browsers other than the above, in-field hints are implemented via a different technique.
Note that placeholder behavior is known to differ in Internet Explorer and certain old
versions of the above browsers due to a recent change in the HTML5 specification regarding
the placeholder
attribute. Under the old rules, the placeholder is cleared
when the element is focused. In the latest HTML5 spec as published by WHATWG, the placeholder
is still displayed when the element is focused as long as the value is an empty string.
Browser | Pseudo-class or pseudo-element |
---|---|
Chrome, Safari | ::-webkit-input-placeholder |
Firefox 4 - 18 | :-moz-placeholder |
Firefox 19+ | ::-moz-placeholder |
Internet Explorer | :-ms-input-placeholder |
Note that unlike other browsers, Firefox 19+ applies opacity:0.4 to the placeholder text. See Bug 556145 - Placeholder text default style should use opacity instead of GrayText
Because browsers are required to ignore the entire rule if a selector is invalid, separate rules are needed for each browser. For example:
::-webkit-input-placeholder { color: blue; opacity: 1; } :-moz-placeholder { color: blue; opacity: 1; } ::-moz-placeholder { color: blue; opacity: 1; } :-ms-input-placeholder { color: blue; opacity: 1; }
If using Sass, it may be useful to utilize Sass' parent selector feature. For example:
.myCustomItem, .myCustomItemRTL, .myCustomItemDisabled, .myCustomItemDisabledRTL, .myCustomItemError, .myCustomItemErrorRTL, .myCustomItemFocused, .myCustomItemFocusedRTL, .myCustomItemHint, .myCustomItemHintRTL, .myCustomItemDisabledHint, .myCustomItemDisabledHintRTL { // ... &::-webkit-input-placeholder { color: blue; opacity: 1; } &:-moz-placeholder { color: blue; opacity: 1; } &::-moz-placeholder { color: blue; opacity: 1; } &:-ms-input-placeholder { color: blue; opacity: 1; } }
If using Compass, the
input-placeholder
mixin
that was added in version 1.0 can further simplify the code to style the placeholder text
For example:
.myCustomItem, .myCustomItemRTL, .myCustomItemDisabled, .myCustomItemDisabledRTL, .myCustomItemError, .myCustomItemErrorRTL, .myCustomItemFocused, .myCustomItemFocusedRTL, .myCustomItemHint, .myCustomItemHintRTL, .myCustomItemDisabledHint, .myCustomItemDisabledHintRTL { // ... @include input-placeholder { color: blue; opacity: 1; } }
Note : This is an advanced setting
usePlaceholderForHint
- New usePlaceholderForHint value. Default value is trueFormItem.setHint(java.lang.String)
,
Appearance overview and related methods
public boolean getUsePlaceholderForHint()
showing the hint in field
and if
supported by the browser, should the HTML5
placeholder
attribute
be used to display the hint within the field? If set to false
, then use of
the placeholder
attribute is disabled and an alternative technique to display
the hint in-field is used instead.
The HTML5 placeholder
attribute is supported in the following major browsers:
WebView
(used by the stock Browser app and when
packaging with PhoneGap
)In browsers other than the above, in-field hints are implemented via a different technique.
Note that placeholder behavior is known to differ in Internet Explorer and certain old
versions of the above browsers due to a recent change in the HTML5 specification regarding
the placeholder
attribute. Under the old rules, the placeholder is cleared
when the element is focused. In the latest HTML5 spec as published by WHATWG, the placeholder
is still displayed when the element is focused as long as the value is an empty string.
Browser | Pseudo-class or pseudo-element |
---|---|
Chrome, Safari | ::-webkit-input-placeholder |
Firefox 4 - 18 | :-moz-placeholder |
Firefox 19+ | ::-moz-placeholder |
Internet Explorer | :-ms-input-placeholder |
Note that unlike other browsers, Firefox 19+ applies opacity:0.4 to the placeholder text. See Bug 556145 - Placeholder text default style should use opacity instead of GrayText
Because browsers are required to ignore the entire rule if a selector is invalid, separate rules are needed for each browser. For example:
::-webkit-input-placeholder { color: blue; opacity: 1; } :-moz-placeholder { color: blue; opacity: 1; } ::-moz-placeholder { color: blue; opacity: 1; } :-ms-input-placeholder { color: blue; opacity: 1; }
If using Sass, it may be useful to utilize Sass' parent selector feature. For example:
.myCustomItem, .myCustomItemRTL, .myCustomItemDisabled, .myCustomItemDisabledRTL, .myCustomItemError, .myCustomItemErrorRTL, .myCustomItemFocused, .myCustomItemFocusedRTL, .myCustomItemHint, .myCustomItemHintRTL, .myCustomItemDisabledHint, .myCustomItemDisabledHintRTL { // ... &::-webkit-input-placeholder { color: blue; opacity: 1; } &:-moz-placeholder { color: blue; opacity: 1; } &::-moz-placeholder { color: blue; opacity: 1; } &:-ms-input-placeholder { color: blue; opacity: 1; } }
If using Compass, the
input-placeholder
mixin
that was added in version 1.0 can further simplify the code to style the placeholder text
For example:
.myCustomItem, .myCustomItemRTL, .myCustomItemDisabled, .myCustomItemDisabledRTL, .myCustomItemError, .myCustomItemErrorRTL, .myCustomItemFocused, .myCustomItemFocusedRTL, .myCustomItemHint, .myCustomItemHintRTL, .myCustomItemDisabledHint, .myCustomItemDisabledHintRTL { // ... @include input-placeholder { color: blue; opacity: 1; } }
FormItem.getHint()
,
Appearance overview and related methods
public void setUseSharedPicker(java.lang.Boolean useSharedPicker)
picker
and pickerProperties
for details
on setting up an unshared picker.useSharedPicker
- New useSharedPicker value. Default value is truepublic java.lang.Boolean getUseSharedPicker()
picker
and pickerProperties
for details
on setting up an unshared picker.public void setUseTextField(java.lang.Boolean useTextField)
single text
field
for working with the item's value. When false or unset, the default, the item's value is represented by
separate day
, month
, and/or year
selectors. In this mode, null values are not
supported, and a default value of Today will be enforced if no defaultValue
is specified. This means that a DateItem
with useTextField
set to false is effectively a required
field.
useTextField
- New useTextField value. Default value is nullBasics overview and related methods
,
Date Examplepublic java.lang.Boolean getUseTextField()
single text
field
for working with the item's value. When false or unset, the default, the item's value is represented by
separate day
, month
, and/or year
selectors. In this mode, null values are not
supported, and a default value of Today will be enforced if no defaultValue
is specified. This means that a DateItem
with useTextField
set to false is effectively a required
field.
Basics overview and related methods
,
Date Examplepublic void setWrapHintText(java.lang.Boolean wrapHintText)
FormItem.hint
, should the
hint text be allowed to wrap? Setting this property to false
will render the hint on a single line without
wrapping, expanding the width required to render the item if necessary. If unset this property will be picked up
from the DynamicForm.wrapHintText
setting.
This
setting does not apply to hints that are shown in field
.
setWrapHintText
in class FormItem
wrapHintText
- New wrapHintText value. Default value is falseFormItem.setMinHintWidth(java.lang.Integer)
public java.lang.Boolean getWrapHintText()
FormItem.hint
, should the
hint text be allowed to wrap? Setting this property to false
will render the hint on a single line without
wrapping, expanding the width required to render the item if necessary. If unset this property will be picked up
from the DynamicForm.wrapHintText
setting.
This
setting does not apply to hints that are shown in field
.
getWrapHintText
in class FormItem
FormItem.getMinHintWidth()
public SelectItem getYearSelector()
This component is an AutoChild named "yearSelector". For an overview of how to use and
configure AutoChildren, see Using AutoChildren
.
getSelectorFormat()
public void setYearSelectorProperties(SelectItem yearSelectorProperties)
yearSelector
.
Note : This is an advanced setting
yearSelectorProperties
- New yearSelectorProperties value. Default value is nullpublic SelectItem getYearSelectorProperties()
yearSelector
.public void deselectValue()
useTextField
is true, falls through to
standard deselectValue()
implementation on this
items freeform text entry field. Otherwise has no effect.public void deselectValue(java.lang.Boolean start)
useTextField
is true, falls through to
standard deselectValue()
implementation on this
items freeform text entry field. Otherwise has no effect.start
- If this parameter is passed, new cursor insertion position will be moved to the start, rather than the end of this
item's value.public java.lang.String getEnteredValue()
useTextField
is true (otherwise returns the result of
this.getValue()).public FiscalCalendar getFiscalCalendar()
FiscalCalendar
object that will be used by this item's DateChooser.public boolean pendingStatusChanged(DynamicForm form, FormItem item, boolean pendingStatus, java.lang.Object newValue, java.lang.Object value)
showPending
is
enabled and this date item should either clear or show its pending visual state. The default behavior is that the
titleStyle
and cellStyle
are updated to include/exclude the "Pending"
suffix. In addition, when displayed in the pending state:
useTextField
is true
, then the "Pending"
suffix will be appended to the textBoxStyle
applied to the textField
; otherwise
useTextField
is false
) the color of the daySelector
, monthSelector
and/or yearSelector
will change when the day, month, or year
is different, respectively. false
will cancel this default behavior.form
- the managing DynamicForm
instance.item
- the form item itself (also available as "this").pendingStatus
- true
if the item should show its pending visual state; false
otherwise.newValue
- the current form item value.value
- the value that would be restored by a call to DynamicForm.resetValues()
.false
to cancel the default behavior.public void selectValue()
useTextField
is true, falls through to
standard selectValue()
implementation on this items
freeform text entry field. Otherwise has no effect.public void setFiscalCalendar()
FiscalCalendar
object that will be used by this item's DateChooser. If
unset, the global fiscal calendar
is used.public void setFiscalCalendar(FiscalCalendar fiscalCalendar)
FiscalCalendar
object that will be used by this item's DateChooser. If
unset, the global fiscal calendar
is used.fiscalCalendar
- the fiscal calendar for this chooser, if set, or the global one otherwisepublic void setSelectionRange(int start, int end)
useTextField
is true, falls through to
standard setSelectionRange()
implementation
on this items freeform text entry field. Otherwise has no effect.start
- character index for start of new selectionend
- character index for end of new selectionpublic static void setDefaultProperties(DateItem dateItemProperties)
Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.
dateItemProperties
- properties that should be used as new defaults when instances of this class are createdSGWTProperties
public java.util.Date getValueAsDate()
public int[] getSelectionRange()
useTextField
is true, falls through to
standard com.smartgwt.client.widgets.form.fields.FormItem#getSelectionRange
implementation on this items
freeform text entry field. Otherwise has no effect.public void setEditorValueFormatter(FormItemValueFormatter formatter)
FormItemValueFormatter
to map this item's current data
value to a display value. Only applies if setUseTextField(java.lang.Boolean)
is true.
Notes
#setDateFormatter()
already provides support for most standard "short date" formats, so
a completely custom formatter method is often not required.DateUtil
class.#setInputFormat()
or
supply a custom #setEditorValueParser()
When writing custom date formatting and parsing logic, developers may find the
DateTimeFormat
class helpful.
setEditorValueFormatter
in class FormItem
formatter
- the FormItemValueFormatterpublic void setEditorValueParser(FormItemValueParser valueParser)
FormItemValueParser
to map a user-entered display value to a data
value for storage. Only applies if #setUseTextField()
is set to true.
A custom parser function will typically only be required if
a custom formatter is specified via setEditorValueFormatter(FormItemValueFormatter)
. Even then,
you may be able to simply specify an inputFormat
that matches the custom display
format for this item.
System-wide custom date parsing and formatting may be achieved via methods on the DateUtil
class.
When writing custom date formatting and parsing logic, developers may find the
DateTimeFormat
class helpful.
setEditorValueParser
in class FormItem
valueParser
- the FormItemValueParser