public class DateBox extends ValueBox<DateBox,elemental2.dom.HTMLInputElement,Date>
Date which opens DatePicker when selecting it.
This component provides either selecting the date using the DatePicker or typing the
date based on the pattern configured to convert it to a valid Date object
For example:
DateBox.create("Birth date").setPattern("yyyy/MM/dd")
DateBox.create("Birth date", new Date(), new DateTimeFormatInfoImpl_fr())
DateBox.create("Birth date")
.setPopoverPosition(PopupPosition.TOP)
.setPickerStyle(DateBox.PickerStyle.POPOVER)
ValueBox,
DatePicker| Modifier and Type | Class and Description |
|---|---|
static class |
DateBox.Pattern
A predefined patterns for the date
|
static class |
DateBox.PickerStyle
The style of the date picker
|
ValueBox.AutoValidate, ValueBox.AutoValidatorBasicFormElement.FieldHandler<T>BaseDominoElement.ElementHandler<T>, BaseDominoElement.ResizeHandler<T>, BaseDominoElement.StyleEditor<E extends elemental2.dom.HTMLElement,T extends org.jboss.elemento.IsElement<E>>, BaseDominoElement.WavesStylerHasChangeHandlers.ChangeHandler<V>HasValidation.ValidatorchangeHandlers, changeListener, DISABLED, fieldContainer, fieldGroup, FLOATING, FOCUSED, inputContainer, inputListenerelement| Constructor and Description |
|---|
DateBox() |
DateBox(Date date) |
DateBox(String label) |
DateBox(String label,
Date date) |
DateBox(String label,
Date date,
Date minDate,
Date maxDate) |
DateBox(String label,
Date date,
org.gwtproject.i18n.shared.cldr.DateTimeFormatInfo dateTimeFormatInfo) |
DateBox(String label,
Date date,
org.gwtproject.i18n.shared.cldr.DateTimeFormatInfo dateTimeFormatInfo,
Date minDate,
Date maxDate) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
clearValue(boolean silent)
clear the field value
|
void |
close() |
static DateBox |
create()
Creates date box with no label
|
static DateBox |
create(Date date)
Creates date box with a
Date |
static DateBox |
create(String label)
Creates date box with a
label |
static DateBox |
create(String label,
Date date)
Creates date box with label and
Date |
static DateBox |
create(String label,
Date date,
org.gwtproject.i18n.shared.cldr.DateTimeFormatInfo dateTimeFormatInfo)
Creates date box with label,
Date and a date time format |
protected ValueBox.AutoValidator |
createAutoValidator(ValueBox.AutoValidate autoValidate)
Create an AutoValidator that will automatically validate the component when it loses focus
|
protected elemental2.dom.HTMLInputElement |
createInputElement(String type)
Creates an input element with the specified type
|
protected DominoElement<elemental2.dom.HTMLDivElement> |
createMandatoryAddOn() |
DateBox |
disable() |
protected void |
doSetValue(Date value) |
DateBox |
enable() |
MdiIcon |
getCalendarIcon() |
DominoElement<elemental2.dom.HTMLDivElement> |
getCalendarIconContainer() |
DatePicker |
getDatePicker() |
Formatter |
getFormatter() |
Optional<ModalDialog> |
getModal() |
Optional<Popover> |
getPopover() |
String |
getStringValue() |
Date |
getValue() |
boolean |
isEmpty() |
boolean |
isEmptyIgnoreSpaces() |
boolean |
isOpenOnClick() |
void |
open()
Opens the date picker based on the
DateBox.PickerStyle defined |
DateBox |
openOnFocus()
Opens the date picker when the element is focused
|
DateBox |
setFormatter(Formatter formatter)
Set a custom
Formatter to use with this DateBox |
DateBox |
setInvalidFormatMessage(String invalidFormatMessage)
Sets the error message when the date is not well formatted
|
DateBox |
setOpenOnClick(boolean openOnClick)
Sets if the date picker should be opened when clicking on the field
|
DateBox |
setParseStrict(boolean parseStrict)
Parse strict means that if the value is not valid, then an exception will be thrown, otherwise
the value will wrapped around as needed
|
DateBox |
setPattern(DateBox.Pattern pattern)
Sets the
DateBox.Pattern of the field |
DateBox |
setPattern(String pattern)
Sets a custom pattern.
|
DateBox |
setPickerStyle(DateBox.PickerStyle pickerStyle)
Sets the
DateBox.PickerStyle |
DateBox |
setPlaceholder(String placeholder) |
DateBox |
setPopoverPosition(PopupPosition popoverPosition)
Sets the position of the model if the
DateBox.PickerStyle is DateBox.PickerStyle.POPOVER |
DateBox |
setReadOnly(boolean readOnly)
set the readonly attribute value
|
addChangeHandler, addLeftAddOn, addLeftAddOn, addLeftAddOn, addOnClearHandler, addRightAddOn, addRightAddOn, addRightAddOn, allowEmptyLabel, asTableField, autoValidate, callChangeHandlers, changeLabelFloating, clear, clear, clearInvalid, clearValue, condense, createLabelElement, doFocus, doUnfocus, element, floating, floatLabel, focus, getAdditionalInfoContainer, getCountItem, getErrorItem, getErrorsContainer, getFieldContainer, getFieldGroup, getFieldInputContainer, getFieldStyle, getFocusColor, getHelperContainer, getHelpItem, getInputContainer, getInputElement, getLabelElement, getLabelTextElement, getLeftAddonContainer, getLeftAddOnsContainer, getMandatoryAddOn, getNotesContainer, getOnClearHandlers, getPlaceholder, getPostfix, getPostFixItem, getPrefix, getPrefixItem, getRightAddonContainer, getRightAddOnsContainer, hasChangeHandler, hideLabelText, hidePlaceholder, invalidate, invalidate, isAddFocusColor, isAutoValidation, isFloating, isFocused, isReadOnly, linkLabelToField, nonfloating, onEnterKey, pauseChangeHandlers, pauseFocusValidation, removeChangeHandler, removeLeftAddOn, removeLeftAddOn, removeLeftAddOn, removeLeftAddOn, removeLeftAddOns, removeOnClearHandler, removeRightAddOn, removeRightAddOn, removeRightAddOn, removeRightAddOn, removeRightAddOns, resumeChangeHandlers, resumeFocusValidation, setAutoValidation, setFieldStyle, setFixErrorsPosition, setFloating, setFocusColor, setLabel, setLabel, setLabel, setLabel, setLabelTextVisible, setPauseChangeHandlers, setPostFix, setPrefix, setSpellCheck, setTableField, shouldShowPlaceholder, showLabelText, showPlaceholder, spread, unfloatLabel, unfocus, updateLabel, value, valueaddValidator, getErrorLabels, getErrors, getHelperText, getLabel, getName, getRequiredErrorMessage, groupBy, hasValidator, isDisabled, isEnabled, isFixErrorsPosition, isRequired, isShowRequiredIndicator, isValidationDisabled, makeErrorLabel, removeValidator, setHelperText, setName, setRequired, setRequired, setRequiredErrorMessage, setShowRequiredIndicator, setValidationDisabled, setValue, showErrors, ungroup, validate, withValidationDisabledadd, add, addClickListener, addCss, addCss, addEventListener, addEventListener, addEventsListener, addHideListener, addShowListener, alignCenter, alignRight, appendChild, appendChild, apply, attr, blur, childNodes, clearElement, contains, contains, contains, containsCss, css, css, cssClassByIndex, cssClassesCount, cssText, elevate, elevate, firstChild, getAttachObserver, getAttribute, getBoundingClientRect, getChildElementCount, getClickableElement, getCollapsible, getCollapsibleElement, getDetachObserver, getDominoId, getElementsCount, getElevation, getFirstChild, getId, getTextContent, getTooltip, getWavesElement, hasAttribute, hasChildNodes, hasDirectChild, hide, hideOn, id, init, insertAfter, insertAfter, insertAfter, insertAfter, insertBefore, insertBefore, insertBefore, insertBefore, insertFirst, insertFirst, insertFirst, isAttached, isCollapsed, isEmptyElement, isEqualNode, isForceHidden, isHidden, item, lastChild, length, onAttached, onDetached, onResize, pullLeft, pullRight, querySelector, querySelectorAll, remove, removeAttachObserver, removeAttribute, removeChild, removeChild, removeCss, removeCss, removeCssProperty, removeDetachObserver, removeEventListener, removeEventListener, removeHideListener, removeHideOn, removeShowListener, removeShowOn, removeTooltip, removeWaves, replaceCss, setAlignItems, setAttribute, setAttribute, setAttribute, setBackgroundColor, setBackgroundColor, setBorder, setBorderColor, setBottom, setBottom, setBoxShadow, setCollapseStrategy, setColor, setColor, setContent, setContent, setCssProperty, setCssProperty, setCursor, setCursor, setDisabled, setDisplay, setDisplay, setDropMenu, setFlex, setFloat, setFloat, setFontSize, setFontSize, setForceHidden, setHeight, setHeight, setId, setInnerHtml, setLeft, setLeft, setLineHeight, setLineHeight, setMargin, setMargin, setMarginBottom, setMarginBottom, setMarginLeft, setMarginLeft, setMarginRight, setMarginRight, setMarginTop, setMarginTop, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setOpacity, setOpacity, setOverFlow, setOverFlow, setOverFlowY, setPadding, setPadding, setPaddingBottom, setPaddingBottom, setPaddingLeft, setPaddingLeft, setPaddingRight, setPaddingRight, setPaddingTop, setPaddingTop, setPointerEvents, setPosition, setPosition, setRight, setRight, setTabIndex, setTextAlign, setTextAlign, setTextContent, setTooltip, setTooltip, setTooltip, setTooltip, setTop, setTop, setTransitionDuration, setWidth, setWidth, setZIndex, show, showOn, style, style, styler, textContent, toggleDisplay, toggleDisplay, withWaves, withWavesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvalidateAllisExpandedadd, add, remove, remove, removeProperty, replace, setProperty, setPropertypublic DateBox()
public DateBox(String label)
public DateBox(Date date)
public DateBox(String label, Date date, org.gwtproject.i18n.shared.cldr.DateTimeFormatInfo dateTimeFormatInfo)
public void close()
public static DateBox create()
public static DateBox create(String label)
labellabel - the field labelpublic static DateBox create(Date date)
Datedate - the field valuepublic static DateBox create(String label, Date date)
Datelabel - the field labeldate - the field valuepublic static DateBox create(String label, Date date, org.gwtproject.i18n.shared.cldr.DateTimeFormatInfo dateTimeFormatInfo)
Date and a date time formatlabel - the field labeldate - the field valuedateTimeFormatInfo - the DateTimeFormatInfopublic DateBox setParseStrict(boolean parseStrict)
parseStrict - true to enable parse strictDateTimeFormat.parseStrict(String),
DateTimeFormat.parse(String)public DateBox setPattern(DateBox.Pattern pattern)
DateBox.Pattern of the fieldpattern - the new DateBox.Patternpublic DateBox setPattern(String pattern)
More information of defining the pattern can be found under GWT DateTimeFormat
pattern - the new patternpublic boolean isEmpty()
public boolean isEmptyIgnoreSpaces()
isEmptyIgnoreSpaces in interface HasGrouping<DateBox>isEmptyIgnoreSpaces in class ValueBox<DateBox,elemental2.dom.HTMLInputElement,Date>protected void clearValue(boolean silent)
clearValue in class ValueBox<DateBox,elemental2.dom.HTMLInputElement,Date>protected void doSetValue(Date value)
doSetValue in class ValueBox<DateBox,elemental2.dom.HTMLInputElement,Date>value - V the value to set for this fieldpublic Date getValue()
protected elemental2.dom.HTMLInputElement createInputElement(String type)
ValueBoxcreateInputElement in class ValueBox<DateBox,elemental2.dom.HTMLInputElement,Date>type - String the input element typepublic DateBox setPlaceholder(String placeholder)
setPlaceholder in interface HasPlaceHolder<DateBox>setPlaceholder in class ValueBox<DateBox,elemental2.dom.HTMLInputElement,Date>placeholder - String placeholderpublic DateBox setPickerStyle(DateBox.PickerStyle pickerStyle)
DateBox.PickerStylepickerStyle - the new DateBox.PickerStylepublic DatePicker getDatePicker()
DatePickerpublic DateBox setPopoverPosition(PopupPosition popoverPosition)
DateBox.PickerStyle is DateBox.PickerStyle.POPOVERpopoverPosition - the new PopupPositionpublic DateBox openOnFocus()
public void open()
DateBox.PickerStyle definedpublic DateBox disable()
public DateBox setReadOnly(boolean readOnly)
setReadOnly in interface IsReadOnly<DateBox>setReadOnly in class ValueBox<DateBox,elemental2.dom.HTMLInputElement,Date>readOnly - boolean, if true switch the component to readonly mode, otherwise switch out
off readonly modepublic DateBox enable()
public String getStringValue()
getStringValue in interface HasInputElementgetStringValue in class ValueBox<DateBox,elemental2.dom.HTMLInputElement,Date>protected DominoElement<elemental2.dom.HTMLDivElement> createMandatoryAddOn()
createMandatoryAddOn in class ValueBox<DateBox,elemental2.dom.HTMLInputElement,Date>FlexItem that contains the mandatory addonspublic DominoElement<elemental2.dom.HTMLDivElement> getCalendarIconContainer()
public MdiIcon getCalendarIcon()
protected ValueBox.AutoValidator createAutoValidator(ValueBox.AutoValidate autoValidate)
createAutoValidator in class ValueBox<DateBox,elemental2.dom.HTMLInputElement,Date>autoValidate - ValueBox.AutoValidatepublic DateBox setInvalidFormatMessage(String invalidFormatMessage)
invalidFormatMessage - the new messagepublic Optional<ModalDialog> getModal()
ModalDialog of the date pickerpublic boolean isOpenOnClick()
public DateBox setOpenOnClick(boolean openOnClick)
openOnClick - true to open the date picker when clicking on the fieldpublic Formatter getFormatter()
Copyright © 2019–2022 Dominokit. All rights reserved.