Class DateRangePicker<D extends DateRange>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.VerticalLayout>
software.xdev.vaadin.daterange_picker.ui.DateRangePicker<D>
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasOrderedComponents,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D>,,DateRangeModel<D>> com.vaadin.flow.component.orderedlayout.FlexComponent,com.vaadin.flow.data.binder.HasItems<D>,Serializable,DateRangeActions<D,DateRangePicker<D>>
@CssImport("./styles/dateRangePicker.css")
public class DateRangePicker<D extends DateRange>
extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.VerticalLayout>
implements com.vaadin.flow.component.orderedlayout.FlexComponent, com.vaadin.flow.data.binder.HasItems<D>, DateRangeActions<D,DateRangePicker<D>>, com.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D>,DateRangeModel<D>>
Represents a Date-Range-Picker
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent
com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment, com.vaadin.flow.component.orderedlayout.FlexComponent.JustifyContentModeNested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final com.vaadin.flow.component.button.Buttonprotected booleanprotected Optional<com.vaadin.flow.component.datepicker.DatePicker.DatePickerI18n>protected com.vaadin.flow.component.ItemLabelGenerator<D>static final Localeprotected booleanprotected DateRangeModel<D>protected static AtomicIntegerprotected final DateRangePickerOverlay<D>protected final com.vaadin.flow.component.html.Divprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionDateRangePicker(Supplier<DateRangeModel<D>> initialModelSupplier) DateRangePicker(Supplier<DateRangeModel<D>> initialModelSupplier, D[] items) DateRangePicker(Supplier<DateRangeModel<D>> initialModelSupplier, Collection<D> items) DateRangePicker(DateRangeModel<D> initialModel) DateRangePicker(DateRangeModel<D> initialModel, D[] items) DateRangePicker(DateRangeModel<D> initialModel, Collection<D> items) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcom.vaadin.flow.shared.RegistrationaddValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener<? super DateRangeValueChangeEvent<D>> listener) voidclear()Do not use this method, as it throws aUnsupportedOperationException
The calling of clear is not supported because DateRangePicker always has a value
UsesetValue(DateRangeModel)instead.protected voidcom.vaadin.flow.component.button.ButtonOptional<com.vaadin.flow.component.datepicker.DatePicker.DatePickerI18n>com.vaadin.flow.component.ItemLabelGenerator<D>DateRangePicker always has a value
However for compatibility reasons (with Vaadin) this returnsnullgetEnd()com.vaadin.flow.component.html.DivgetStart()getValue()protected voidinitUI()booleanbooleanbooleanisEmpty()DateRangePicker always has a value
Therefore this always returnsfalsebooleanbooleanbooleanThe required indicator is not implemented
This will always returnfalseprotected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidvoidsetAllowRangeLimitExceeding(boolean allowRangeLimitExceeding) Allows the maximum start and end date to be greater or less than the configured end or start date.setDateRange(D dateRange) voidsetDateRangeForToday(D range) Uses the givenDateRangeand calculates with the current Date theDateRangeModel, which is then set bysetValue(DateRangeModel)voidsetDateRangeOptionsLabel(String label) Sets the label for the overlay DateRange-ComboBoxvoidsetEndLabel(String label) Sets the label for the overlay End-DatePickerprotected voidsetExpanded(boolean expanded) voidsetItems(Collection<D> items) protected voidvoidsetReadOnly(boolean readOnly) voidsetRequiredIndicatorVisible(boolean requiredIndicatorVisible) The required indicator is not implemented
This method doesn't have any functionallityvoidsetStartLabel(String label) Sets the label for the overlay Start-DatePickervoidsetValue(DateRangeModel<D> value) protected voidtoggle()protected voidprotected voidupdateFromModel(boolean updateOverlay) withAllowRangeLimitExceeding(boolean allowRangeLimitExceeding) Shortcut forsetAllowRangeLimitExceeding(boolean)withCloseOnOutsideClick(boolean closeOnOutsideClick) withDatePickerI18n(com.vaadin.flow.component.datepicker.DatePicker.DatePickerI18n datePickerI18n) withDateRangeLocalizerFunction(com.vaadin.flow.component.ItemLabelGenerator<D> dateRangeLocalizerFunction) withDateRangeOptionsLabel(String label) Shortcut forsetDateRangeOptionsLabel(String)withEndLabel(String label) Shortcut forsetEndLabel(String)withFormatLocale(Locale locale) Sets the locale used for formatting the "expand" button.withStartLabel(String label) Shortcut forsetStartLabel(String)Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement, initContentMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent
expand, getAlignItems, getAlignSelf, getFlexGrow, getFlexShrink, getJustifyContentMode, replace, setAlignItems, setAlignSelf, setFlexGrow, setFlexShrink, setJustifyContentModeMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.data.binder.HasItems
setItems, setItemsMethods inherited from interface com.vaadin.flow.component.HasOrderedComponents
getChildren, getComponentAt, getComponentCount, indexOfMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasValue
getOptionalValue
-
Field Details
-
DEFAULT_LOCALE
-
nextID
-
expanded
protected boolean expanded -
model
-
useClientSideLocale
protected boolean useClientSideLocale -
formatLocale
-
dateRangeLocalizerFunction
-
datePickerI18n
-
closeOnOutsideClick
protected boolean closeOnOutsideClick -
allowRangeLimitExceeding
protected boolean allowRangeLimitExceeding -
btnOverview
protected final com.vaadin.flow.component.button.Button btnOverview -
overlayContainer
protected final com.vaadin.flow.component.html.Div overlayContainer -
overlay
-
-
Constructor Details
-
DateRangePicker
-
DateRangePicker
-
DateRangePicker
-
DateRangePicker
-
DateRangePicker
-
DateRangePicker
-
-
Method Details
-
withCloseOnOutsideClick
-
isCloseOnOutsideClick
public boolean isCloseOnOutsideClick() -
withDatePickerI18n
public DateRangePicker<D> withDatePickerI18n(com.vaadin.flow.component.datepicker.DatePicker.DatePickerI18n datePickerI18n) -
getDatePickerI18n
-
withFormatLocale
Sets the locale used for formatting the "expand" button.If the locale is
null(default) the clientside locale will be used orLocale.USif none could be detected. -
getFormatLocale
-
withDateRangeLocalizerFunction
public DateRangePicker<D> withDateRangeLocalizerFunction(com.vaadin.flow.component.ItemLabelGenerator<D> dateRangeLocalizerFunction) -
getDateRangeLocalizerFunction
-
withStartLabel
Shortcut forsetStartLabel(String) -
withEndLabel
Shortcut forsetEndLabel(String) -
withDateRangeOptionsLabel
Shortcut forsetDateRangeOptionsLabel(String) -
withAllowRangeLimitExceeding
Shortcut forsetAllowRangeLimitExceeding(boolean) -
initUI
protected void initUI() -
registerListeners
protected void registerListeners() -
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
setLocaleFromClient
protected void setLocaleFromClient() -
addClickOutsideListener
protected void addClickOutsideListener() -
clickOutsideOccurred
@ClientCallable protected void clickOutsideOccurred() -
updateFromModel
protected void updateFromModel(boolean updateOverlay) -
tryFixInvalidModel
protected void tryFixInvalidModel() -
toggle
protected void toggle() -
setExpanded
protected void setExpanded(boolean expanded) -
isExpanded
public boolean isExpanded() -
getOverlay
-
getBtnOverview
public com.vaadin.flow.component.button.Button getBtnOverview() -
getOverlayContainer
public com.vaadin.flow.component.html.Div getOverlayContainer() -
setStartLabel
Sets the label for the overlay Start-DatePicker -
setEndLabel
Sets the label for the overlay End-DatePicker -
setDateRangeOptionsLabel
Sets the label for the overlay DateRange-ComboBox -
setAllowRangeLimitExceeding
public void setAllowRangeLimitExceeding(boolean allowRangeLimitExceeding) Allows the maximum start and end date to be greater or less than the configured end or start date. This is only the case whenDateRange.isCalcable()istrue. Otherwise incorrect values (e.g. start before end) could be set. -
isAllowRangeLimitExceeding
public boolean isAllowRangeLimitExceeding() -
setDateRangeForToday
Uses the givenDateRangeand calculates with the current Date theDateRangeModel, which is then set bysetValue(DateRangeModel) -
setItems
-
getStart
- Specified by:
getStartin interfaceDateRangeActions<D extends DateRange,DateRangePicker<D extends DateRange>>
-
setStart
- Specified by:
setStartin interfaceDateRangeActions<D extends DateRange,DateRangePicker<D extends DateRange>>
-
getEnd
- Specified by:
getEndin interfaceDateRangeActions<D extends DateRange,DateRangePicker<D extends DateRange>>
-
setEnd
- Specified by:
setEndin interfaceDateRangeActions<D extends DateRange,DateRangePicker<D extends DateRange>>
-
getDateRange
- Specified by:
getDateRangein interfaceDateRangeActions<D extends DateRange,DateRangePicker<D extends DateRange>>
-
setDateRange
- Specified by:
setDateRangein interfaceDateRangeActions<D extends DateRange,DateRangePicker<D extends DateRange>>
-
setValue
- Specified by:
setValuein interfacecom.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D extends DateRange>,DateRangeModel<D extends DateRange>>
-
getValue
- Specified by:
getValuein interfacecom.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D extends DateRange>,DateRangeModel<D extends DateRange>>
-
addValueChangeListener
public com.vaadin.flow.shared.Registration addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener<? super DateRangeValueChangeEvent<D>> listener) - Specified by:
addValueChangeListenerin interfacecom.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D extends DateRange>,DateRangeModel<D extends DateRange>>
-
getEmptyValue
DateRangePicker always has a value
However for compatibility reasons (with Vaadin) this returnsnull- Specified by:
getEmptyValuein interfacecom.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D extends DateRange>,DateRangeModel<D extends DateRange>> - Returns:
null
-
isEmpty
public boolean isEmpty()DateRangePicker always has a value
Therefore this always returnsfalse- Specified by:
isEmptyin interfacecom.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D extends DateRange>,DateRangeModel<D extends DateRange>> - Returns:
false
-
clear
public void clear()Do not use this method, as it throws aUnsupportedOperationException
The calling of clear is not supported because DateRangePicker always has a value
UsesetValue(DateRangeModel)instead.- Specified by:
clearin interfacecom.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D extends DateRange>,DateRangeModel<D extends DateRange>> - Throws:
UnsupportedOperationException- DateRangePicker always has a value
-
setReadOnly
public void setReadOnly(boolean readOnly) - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D extends DateRange>,DateRangeModel<D extends DateRange>>
-
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnlyin interfacecom.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D extends DateRange>,DateRangeModel<D extends DateRange>>
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible) The required indicator is not implemented
This method doesn't have any functionallity- Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D extends DateRange>,DateRangeModel<D extends DateRange>>
-
isRequiredIndicatorVisible
public boolean isRequiredIndicatorVisible()The required indicator is not implemented
This will always returnfalse- Specified by:
isRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<DateRangeValueChangeEvent<D extends DateRange>,DateRangeModel<D extends DateRange>> - Returns:
false
-