Class EnhancedDateTimeRangePicker

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,T>
com.vaadin.flow.component.AbstractSinglePropertyField<EnhancedDateTimeRangePicker,DateTimeRange>
com.vaadin.componentfactory.datetimerangepicker.EnhancedDateTimeRangePicker
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.HasLabel, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>,DateTimeRange>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>,DateTimeRange>, com.vaadin.flow.component.shared.HasClearButton, Serializable

@JsModule("./date-fns-limited.min.js") @JsModule("./enhancedDateTimeRangePickerConnector.js") @JsModule("@vaadin-component-factory/vcf-date-time-range-picker/vcf-date-time-range-picker.js") @Tag("vcf-date-time-range-picker") @NpmPackage(value="@vaadin-component-factory/vcf-date-time-range-picker", version="1.0.0") public class EnhancedDateTimeRangePicker extends com.vaadin.flow.component.AbstractSinglePropertyField<EnhancedDateTimeRangePicker,DateTimeRange> implements com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.shared.HasClearButton, com.vaadin.flow.component.HasLabel
Server-side component that encapsulates the functionality of the vcf-date-time-range-picker webcomponent.

It allows setting and getting LocalDateTime objects, setting minimum and maximum date ranges and has internationalization support by using the EnhancedDateTimeRangePicker.DatePickerI18n object.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The internationalization properties for EnhancedDateTimeRangePicker.
    static class 
    invalid-changed event is sent when the invalid state changes.
    static class 
    opened-changed event is sent when the overlay opened state changes.

    Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField

    com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V extends Object>

    Nested 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

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    Convenience constructor to create a date time range picker with a pre-selected date time range in current UI locale setPattern.
    EnhancedDateTimeRangePicker(DateTimeRange initialDate, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>> listener)
    Convenience constructor to create a date-time range picker with a pre-selected date in current UI locale setPattern and a HasValue.ValueChangeListener.
    EnhancedDateTimeRangePicker(DateTimeRange initialDate, String formattingPattern)
    Convenience Constructor to create a date-time range picker with pre-selected date and pattern setup.
    EnhancedDateTimeRangePicker(DateTimeRange initialDate, String formattingPattern, String... parserPatterns)
    Convenience Constructor to create a date-time range picker with pre-selected date, formatting pattern, and parsing patterns.
    Convenience Constructor to create a date-time range picker with pre-selected date and locale setup.
    EnhancedDateTimeRangePicker(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>> listener)
    Convenience constructor to create a date-time range picker with a HasValue.ValueChangeListener.
    Convenience constructor to create a date-time range picker with a label.
    Convenience constructor to create a date-time range picker with a pre-selected date in current UI locale setPattern and a label.
    EnhancedDateTimeRangePicker(String label, DateTimeRange initialDate, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>> listener)
    Convenience constructor to create a date-time range picker with a pre-selected date in current UI locale setPattern, a HasValue.ValueChangeListener and a label.
    EnhancedDateTimeRangePicker(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>> listener)
    Convenience constructor to create a date-time range picker with a HasValue.ValueChangeListener and a label.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(com.vaadin.flow.component.Component... components)
     
    com.vaadin.flow.shared.Registration
    addInvalidChangeListener(com.vaadin.flow.component.ComponentEventListener<EnhancedDateTimeRangePicker.InvalidChangeEvent> listener)
    Adds a listener for invalid-changed events fired by the webcomponent.
    com.vaadin.flow.shared.Registration
    addOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<EnhancedDateTimeRangePicker.OpenedChangeEvent> listener)
    Adds a listener for opened-changed events fired by the webcomponent.
    protected void
    Closes the date-time range picker overlay.
    void
    Deprecated.
     
    Gets the placeholder of the end date part of the date-time range picker.
    protected String
    Gets the placeholder of the end time part of the date-time range picker.
    Gets the current error message from the datepicker.
    Gets the internationalization object previously set for this component.
    Get the visible date when there is no value selected.
    Gets the label of the date-time range picker.
    Gets the Locale for this date picker
    Gets the maximum date in the picker.
    Gets the minimum date in the picker.
    Gets the name of the EnhancedDatePicker.
    Gets the parser patterns for this date-picker
    Gets the Pattern for this date picker
    com.vaadin.flow.component.Component
    Gets the component in the prefix slot of this field.
    Gets the placeholder of the start date part of the date-time range picker.
    protected String
    Gets the placeholder of the start time part of the date-time range picker.
    boolean
    When auto open is enabled, the dropdown will open when the field is clicked.
    boolean
    Gets the validity of the date-time range picker date value output.
    boolean
    Gets the states of the drop-down for the date-time range picker
    boolean
    Determines whether the date-time picker is marked as input required.
    boolean
    Returns whether the side panel is currently visible in the date-time range picker.
    boolean
    Returns whether the text fields are currently visible in the date-time range picker.
    boolean
    Get the state of showWeekNumbers property of the datepicker
    protected void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
     
    void
    Opens the date-time range picker overlay.
    void
    openOnPosition(int x, int y)
    Opens the date-time range picker overlay.
    void
    remove(com.vaadin.flow.component.Component... components)
    Removes the given child components from this component.
    void
    Removes all contents from this component, this includes child components, text content as well as child elements that have been added directly to this component using the Element API.
    void
     
    void
    setAutoOpen(boolean autoOpen)
    When auto open is enabled, the dropdown will open when the field is clicked.
    void
    setClassNameForDates(String className, LocalDate... dates)
     
    void
    setEndDatePlaceholder(String endDatePlaceholder)
    Sets the placeholder for the end date part of the date-time range picker.
    void
    setEndTimePlaceholder(String endDatePlaceholder)
    Sets the placeholder for the end time part of the date-time range picker.
    void
    setErrorMessage(String errorMessage)
     
    void
    Sets the internationalization properties for this component.
    void
    setInitialPosition(LocalDate initialPosition)
    Date which should be visible when there is no value selected.
    void
    setInvalid(boolean invalid)
     
    void
    Sets the label for the date-time range picker.
    void
    setLocale(Locale locale)
    Set the Locale for the Date Picker.
    void
    Sets the maximum date in the picker.
    void
    Sets the minimum date in the picker.
    void
     
    void
    setParsers(String... parserPatterns)
    Setting the patterns for parsing the value of the date in the picker.
    void
    setPattern(String formattingPattern)
    Setting the Pattern for formatting value of the date picker
    void
    setPrefixComponent(com.vaadin.flow.component.Component component)
    Adds the given component into this field before the content, replacing any existing prefix component.
    void
    setRequired(boolean required)
     
    void
    setRequiredIndicatorVisible(boolean required)
     
    void
    setSidePanelVisible(boolean sidePanelVisible)
    Sets the visibility of the side panel in the date-time range picker.
    void
    setStartDatePlaceholder(String startDatePlaceholder)
    Sets the placeholder for the start date part of the date-time range picker.
    void
    setStartTimePlaceholder(String startTimePlaceholder)
    Sets the placeholder for the start time part of the date-time range picker.
    void
    setTextFieldsVisible(boolean textFieldsVisible)
    Sets the visibility of the text fields in the date-time range picker.
    void
     
    void
    setWeekNumbersVisible(boolean weekNumbersVisible)
    Set the week number visible in the EnhancedDateTimeRangePicker.
    protected void
    Performs server-side validation of the current value.

    Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField

    getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent

    Methods inherited from class com.vaadin.flow.component.AbstractField

    addValueChangeListener, getValue, isEmpty, setModelValue, valueEquals

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.shared.HasClearButton

    isClearButtonVisible, setClearButtonVisible

    Methods inherited from interface com.vaadin.flow.component.HasComponents

    add, add, addComponentAsFirst, addComponentAtIndex, remove

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods 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, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasValidation

    setManualValidation

    Methods inherited from interface com.vaadin.flow.component.HasValue

    clear, getOptionalValue

    Methods inherited from interface com.vaadin.flow.component.HasValueAndElement

    isReadOnly, isRequiredIndicatorVisible, setReadOnly
  • Field Details

  • Constructor Details

    • EnhancedDateTimeRangePicker

      public EnhancedDateTimeRangePicker()
      Default constructor.
    • EnhancedDateTimeRangePicker

      public EnhancedDateTimeRangePicker(DateTimeRange initialDate)
      Convenience constructor to create a date time range picker with a pre-selected date time range in current UI locale setPattern.
      Parameters:
      initialDate - the pre-selected date time range in the picker
      See Also:
      • AbstractField.setValue(Object)
    • EnhancedDateTimeRangePicker

      public EnhancedDateTimeRangePicker(String label)
      Convenience constructor to create a date-time range picker with a label.
      Parameters:
      label - the label describing the date-time range picker
      See Also:
    • EnhancedDateTimeRangePicker

      public EnhancedDateTimeRangePicker(String label, DateTimeRange initialDate)
      Convenience constructor to create a date-time range picker with a pre-selected date in current UI locale setPattern and a label.
      Parameters:
      label - the label describing the date picker
      initialDate - the pre-selected date in the picker
      See Also:
    • EnhancedDateTimeRangePicker

      public EnhancedDateTimeRangePicker(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>> listener)
      Convenience constructor to create a date-time range picker with a HasValue.ValueChangeListener.
      Parameters:
      listener - the listener to receive value change events
      See Also:
      • AbstractField.addValueChangeListener(HasValue.ValueChangeListener)
    • EnhancedDateTimeRangePicker

      public EnhancedDateTimeRangePicker(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>> listener)
      Convenience constructor to create a date-time range picker with a HasValue.ValueChangeListener and a label.
      Parameters:
      label - the label describing the date picker
      listener - the listener to receive value change events
      See Also:
      • setLabel(String)
      • AbstractField.addValueChangeListener(HasValue.ValueChangeListener)
    • EnhancedDateTimeRangePicker

      public EnhancedDateTimeRangePicker(DateTimeRange initialDate, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>> listener)
      Convenience constructor to create a date-time range picker with a pre-selected date in current UI locale setPattern and a HasValue.ValueChangeListener.
      Parameters:
      initialDate - the pre-selected date in the picker
      listener - the listener to receive value change events
      See Also:
      • AbstractField.setValue(Object)
      • AbstractField.addValueChangeListener(HasValue.ValueChangeListener)
    • EnhancedDateTimeRangePicker

      public EnhancedDateTimeRangePicker(String label, DateTimeRange initialDate, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>> listener)
      Convenience constructor to create a date-time range picker with a pre-selected date in current UI locale setPattern, a HasValue.ValueChangeListener and a label.
      Parameters:
      label - the label describing the date picker
      initialDate - the pre-selected date in the picker
      listener - the listener to receive value change events
      See Also:
      • setLabel(String)
      • AbstractField.setValue(Object)
      • AbstractField.addValueChangeListener(HasValue.ValueChangeListener)
    • EnhancedDateTimeRangePicker

      public EnhancedDateTimeRangePicker(DateTimeRange initialDate, Locale locale)
      Convenience Constructor to create a date-time range picker with pre-selected date and locale setup.
      Parameters:
      initialDate - the pre-selected date-ime in the picker
      locale - the locale for the picker
    • EnhancedDateTimeRangePicker

      public EnhancedDateTimeRangePicker(DateTimeRange initialDate, String formattingPattern)
      Convenience Constructor to create a date-time range picker with pre-selected date and pattern setup.
      Parameters:
      initialDate - the pre-selected date in the picker
      formattingPattern - the pattern for formatting value of the picker
    • EnhancedDateTimeRangePicker

      public EnhancedDateTimeRangePicker(DateTimeRange initialDate, String formattingPattern, String... parserPatterns)
      Convenience Constructor to create a date-time range picker with pre-selected date, formatting pattern, and parsing patterns.
      Parameters:
      initialDate - the pre-selected date in the picker
      formattingPattern - the pattern for formatting value of the date picker
      parserPatterns - the array of patterns used for parsing the date picker's value
  • Method Details

    • disableClientValidation

      @Deprecated public void disableClientValidation()
      Deprecated.
      EnhancedDatePicker has workaround to this issue https://github.com/vaadin/vaadin-date-picker-flow/issues/223 Calling disableClientValidation() after instantiation will make EnhancedDatePicker to behave similar way as regular DatePicker with client side validations. This method is provided if you need to retain that behavior instead.
    • setMin

      public void setMin(LocalDate min)
      Sets the minimum date in the picker. Dates before that will be disabled in the popup.
      Parameters:
      min - the minimum date that is allowed to be selected, or null to remove any minimum constraints
    • getMin

      public LocalDate getMin()
      Gets the minimum date in the picker. Dates before that will be disabled in the popup.
      Returns:
      the minimum date that is allowed to be selected, or null if there's no minimum
    • setMax

      public void setMax(LocalDate max)
      Sets the maximum date in the picker. Dates after that will be disabled in the popup.
      Parameters:
      max - the maximum date that is allowed to be selected, or null to remove any maximum constraints
    • getMax

      public LocalDate getMax()
      Gets the maximum date in the picker. Dates after that will be disabled in the popup.
      Returns:
      the maximum date that is allowed to be selected, or null if there's no maximum
    • setLocale

      public void setLocale(Locale locale)
      Set the Locale for the Date Picker. The displayed date will be matched to the format used in that locale. If this method is never called, the Locale will default to the UI's Locale.

      NOTE:Supported formats are MM/DD/YYYY, DD/MM/YYYY and YYYY/MM/DD. Browser compatibility can be different based on the browser and mobile devices, you can check here for more details: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString

      Parameters:
      locale - the locale set to the date picker, cannot be null
    • getLocale

      public Locale getLocale()
      Gets the Locale for this date picker
      Overrides:
      getLocale in class com.vaadin.flow.component.Component
      Returns:
      the locale used for this picker
    • setParsers

      public void setParsers(String... parserPatterns)
      Setting the patterns for parsing the value of the date in the picker. The parsing will be attempted according to the order of the supplied patterns. If none of these patterns can successfully parse the date-picker's value, the parsing will, first, be attempted using the formatting value (which can be set using @setPattern). If the latter also fails, parsing will be attempted using the Locale (which can be set using @setLocale).
      Parameters:
      parserPatterns - the array of patterns used for parsing the date picker's value
    • getParsers

      public String[] getParsers()
      Gets the parser patterns for this date-picker
      Returns:
      an array of the parser patterns used for formatting value of the date picker
    • setPattern

      public void setPattern(String formattingPattern)
      Setting the Pattern for formatting value of the date picker
      Parameters:
      formattingPattern - the pattern for formatting value of the date picker if set to null or empty string then for matting will be done by Locale
    • setClassNameForDates

      public void setClassNameForDates(String className, LocalDate... dates)
    • getPattern

      public String getPattern()
      Gets the Pattern for this date picker
      Returns:
      the pattern for formatting value of the date picker
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • getI18n

      Gets the internationalization object previously set for this component.

      Note: updating the object content that is gotten from this method will not update the lang on the component if not set back using setI18n(DatePickerI18n)

      Returns:
      the i18n object. It will be null, If the i18n properties weren't set.
    • setI18n

      public void setI18n(EnhancedDateTimeRangePicker.DatePickerI18n i18n)
      Sets the internationalization properties for this component.
      Parameters:
      i18n - the internationalized properties, not null
    • setErrorMessage

      public void setErrorMessage(String errorMessage)
      Specified by:
      setErrorMessage in interface com.vaadin.flow.component.HasValidation
    • getErrorMessage

      public String getErrorMessage()
      Gets the current error message from the datepicker.
      Specified by:
      getErrorMessage in interface com.vaadin.flow.component.HasValidation
      Returns:
      the current error message
    • setInvalid

      public void setInvalid(boolean invalid)
      Specified by:
      setInvalid in interface com.vaadin.flow.component.HasValidation
    • isInvalid

      public boolean isInvalid()
      Gets the validity of the date-time range picker date value output.

      return true, if the value is invalid.

      Specified by:
      isInvalid in interface com.vaadin.flow.component.HasValidation
      Returns:
      the validity property from the date-time range picker
    • setSidePanelVisible

      public void setSidePanelVisible(boolean sidePanelVisible)
      Sets the visibility of the side panel in the date-time range picker.

      The side panel typically includes shortcuts or additional controls.

      Parameters:
      sidePanelVisible - true to show the side panel, false to hide it
    • isSidePanelVisible

      public boolean isSidePanelVisible()
      Returns whether the side panel is currently visible in the date-time range picker.
      Returns:
      true if the side panel is visible, false otherwise
      See Also:
    • setTextFieldsVisible

      public void setTextFieldsVisible(boolean textFieldsVisible)
      Sets the visibility of the text fields in the date-time range picker.

      Text fields allow manual entry of the date and time values.

      Parameters:
      textFieldsVisible - true to show the text fields, false to hide them
    • isTextFieldsVisible

      public boolean isTextFieldsVisible()
      Returns whether the text fields are currently visible in the date-time range picker.
      Returns:
      true if the text fields are visible, false otherwise
      See Also:
    • setLabel

      public void setLabel(String label)
      Sets the label for the date-time range picker.
      Specified by:
      setLabel in interface com.vaadin.flow.component.HasLabel
      Parameters:
      label - the label for the date-time range picker
    • getLabel

      public String getLabel()
      Gets the label of the date-time range picker.
      Specified by:
      getLabel in interface com.vaadin.flow.component.HasLabel
      Returns:
      the label property of the date-time range picker
    • setStartDatePlaceholder

      public void setStartDatePlaceholder(String startDatePlaceholder)
      Sets the placeholder for the start date part of the date-time range picker.
      Parameters:
      startDatePlaceholder - the placeholder for the start date part of the date-time range picker
    • setEndDatePlaceholder

      public void setEndDatePlaceholder(String endDatePlaceholder)
      Sets the placeholder for the end date part of the date-time range picker.
      Parameters:
      endDatePlaceholder - the placeholder for the end date part of the date-time range picker
    • getStartDatePlaceholder

      public String getStartDatePlaceholder()
      Gets the placeholder of the start date part of the date-time range picker.
      Returns:
      the startDatePlaceholder property of the date-time range picker
    • getEndDatePlaceholder

      public String getEndDatePlaceholder()
      Gets the placeholder of the end date part of the date-time range picker.
      Returns:
      the endDatePlaceholder property of the date-time range picker
    • setStartTimePlaceholder

      public void setStartTimePlaceholder(String startTimePlaceholder)
      Sets the placeholder for the start time part of the date-time range picker.
      Parameters:
      startTimePlaceholder - the placeholder for the start time part of the date-time range picker
    • setEndTimePlaceholder

      public void setEndTimePlaceholder(String endDatePlaceholder)
      Sets the placeholder for the end time part of the date-time range picker.
      Parameters:
      endDatePlaceholder - the placeholder for the end time part of the date-time range picker
    • getStartTimePlaceholder

      protected String getStartTimePlaceholder()
      Gets the placeholder of the start time part of the date-time range picker.
      Returns:
      the startTimePlaceholder property of the date-time range picker
    • getEndTimePlaceholder

      protected String getEndTimePlaceholder()
      Gets the placeholder of the end time part of the date-time range picker.
      Returns:
      the endTimePlaceholder property of the date-time range picker
    • setInitialPosition

      public void setInitialPosition(LocalDate initialPosition)
      Date which should be visible when there is no value selected.

      The same date formats as for the value property are supported.

      Parameters:
      initialPosition - the LocalDate value to set
    • getInitialPosition

      public LocalDate getInitialPosition()
      Get the visible date when there is no value selected.

      The same date formats as for the value property are supported.

      This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.

      Returns:
      the initialPosition property from the datepicker
    • setRequired

      public void setRequired(boolean required)
    • setRequiredIndicatorVisible

      public void setRequiredIndicatorVisible(boolean required)
      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>,DateTimeRange>
      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>,DateTimeRange>
    • isRequired

      public boolean isRequired()
      Determines whether the date-time picker is marked as input required.

      This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.

      Returns:
      true if the input is required, false otherwise
    • setWeekNumbersVisible

      public void setWeekNumbersVisible(boolean weekNumbersVisible)
      Set the week number visible in the EnhancedDateTimeRangePicker.

      Set true to display ISO-8601 week numbers in the calendar.

      Notice that displaying week numbers is only supported when i18n.firstDayOfWeek is 1 (Monday).

      Parameters:
      weekNumbersVisible - the boolean value to set
    • isWeekNumbersVisible

      public boolean isWeekNumbersVisible()
      Get the state of showWeekNumbers property of the datepicker

      This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.

      Returns:
      the showWeekNumbers property from the date-time range picker
    • open

      public void open()
      Opens the date-time range picker overlay.
    • openOnPosition

      public void openOnPosition(int x, int y)
      Opens the date-time range picker overlay.
    • close

      protected void close()
      Closes the date-time range picker overlay.
    • isOpened

      public boolean isOpened()
      Gets the states of the drop-down for the date-time range picker
      Returns:
      true if the drop-down is opened, false otherwise
    • setAutoOpen

      public void setAutoOpen(boolean autoOpen)
      When auto open is enabled, the dropdown will open when the field is clicked.
      Parameters:
      autoOpen - Value for the auto open property,
    • isAutoOpen

      public boolean isAutoOpen()
      When auto open is enabled, the dropdown will open when the field is clicked.
      Returns:
      true if auto open is enabled. false otherwise. Default is true
    • setName

      public void setName(String name)
    • validate

      protected void validate()
      Performs server-side validation of the current value. This is needed because it is possible to circumvent the client-side validation constraints using browser development tools.
    • getName

      public String getName()
      Gets the name of the EnhancedDatePicker.
      Returns:
      the name property from the EnhancedDatePicker
    • addOpenedChangeListener

      public com.vaadin.flow.shared.Registration addOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<EnhancedDateTimeRangePicker.OpenedChangeEvent> listener)
      Adds a listener for opened-changed events fired by the webcomponent.
      Parameters:
      listener - the listener
      Returns:
      a Registration for removing the event listener
    • addInvalidChangeListener

      public com.vaadin.flow.shared.Registration addInvalidChangeListener(com.vaadin.flow.component.ComponentEventListener<EnhancedDateTimeRangePicker.InvalidChangeEvent> listener)
      Adds a listener for invalid-changed events fired by the webcomponent.
      Parameters:
      listener - the listener
      Returns:
      a Registration for removing the event listener
    • setPrefixComponent

      public void setPrefixComponent(com.vaadin.flow.component.Component component)
      Adds the given component into this field before the content, replacing any existing prefix component.

      This is most commonly used to add a simple icon or static text into the field.

      Parameters:
      component - the component to set, can be null to remove existing prefix component
    • getPrefixComponent

      public com.vaadin.flow.component.Component getPrefixComponent()
      Gets the component in the prefix slot of this field.
      Returns:
      the prefix component of this field, or null if no prefix component has been set
      See Also:
    • removeAll

      public void removeAll()
      Removes all contents from this component, this includes child components, text content as well as child elements that have been added directly to this component using the Element API.
      Specified by:
      removeAll in interface com.vaadin.flow.component.HasComponents
    • remove

      public void remove(com.vaadin.flow.component.Component... components)
      Removes the given child components from this component.
      Specified by:
      remove in interface com.vaadin.flow.component.HasComponents
      Parameters:
      components - The components to remove.
      Throws:
      IllegalArgumentException - if any of the components is not a child of this component.
    • add

      public void add(com.vaadin.flow.component.Component... components)
      Specified by:
      add in interface com.vaadin.flow.component.HasComponents
    • removePresetByIds

      public void removePresetByIds(String... ids)
    • setValue

      public void setValue(DateTimeRange value)
      Specified by:
      setValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>,DateTimeRange>
      Overrides:
      setValue in class com.vaadin.flow.component.AbstractField<EnhancedDateTimeRangePicker,DateTimeRange>
    • getEmptyValue

      public DateTimeRange getEmptyValue()
      Specified by:
      getEmptyValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<EnhancedDateTimeRangePicker,DateTimeRange>,DateTimeRange>
      Overrides:
      getEmptyValue in class com.vaadin.flow.component.AbstractField<EnhancedDateTimeRangePicker,DateTimeRange>