Package com.vaadin.ui

Class AbstractLocalDateField

    • Constructor Detail

      • AbstractLocalDateField

        public AbstractLocalDateField()
        Constructs an empty AbstractLocalDateField with no caption.
      • AbstractLocalDateField

        public AbstractLocalDateField​(java.lang.String caption)
        Constructs an empty AbstractLocalDateField with caption.
        Parameters:
        caption - the caption of the datefield.
      • AbstractLocalDateField

        public AbstractLocalDateField​(java.lang.String caption,
                                      java.time.LocalDate value)
        Constructs a new AbstractLocalDateField with the given caption and initial text contents.
        Parameters:
        caption - the caption String for the editor.
        value - the LocalDate value.
    • Method Detail

      • getDatePart

        protected int getDatePart​(java.time.LocalDate date,
                                  com.vaadin.shared.ui.datefield.DateResolution resolution)
        Description copied from class: AbstractDateField
        Returns a date integer value part for the given date for the given resolution.
        Specified by:
        getDatePart in class AbstractDateField<java.time.LocalDate,​com.vaadin.shared.ui.datefield.DateResolution>
        Parameters:
        date - the given date, can be null
        resolution - the resolution to extract a value from the date by, not null
        Returns:
        the integer value part of the date by the given resolution
      • buildDate

        protected java.time.LocalDate buildDate​(java.util.Map<com.vaadin.shared.ui.datefield.DateResolution,​java.lang.Integer> resolutionValues)
        Description copied from class: AbstractDateField
        Builds date by the given resolutionValues which is a map whose keys are resolution and integer values.

        This is the opposite to AbstractDateField.getDatePart(Temporal, Enum).

        Specified by:
        buildDate in class AbstractDateField<java.time.LocalDate,​com.vaadin.shared.ui.datefield.DateResolution>
        Parameters:
        resolutionValues - date values to construct a date
        Returns:
        date built from the given map of date values
      • getRangeValidator

        protected RangeValidator<java.time.LocalDate> getRangeValidator()
        Description copied from class: AbstractDateField
        Returns a custom date range validator which is applicable for the type T.
        Specified by:
        getRangeValidator in class AbstractDateField<java.time.LocalDate,​com.vaadin.shared.ui.datefield.DateResolution>
        Returns:
        the date range validator
      • getState

        protected com.vaadin.shared.ui.datefield.AbstractTextualDateFieldState getState()
        Description copied from class: AbstractComponent
        Returns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().
        Overrides:
        getState in class AbstractDateField<java.time.LocalDate,​com.vaadin.shared.ui.datefield.DateResolution>
        Returns:
        updated component shared state
      • getState

        protected com.vaadin.shared.ui.datefield.AbstractTextualDateFieldState getState​(boolean markAsDirty)
        Description copied from class: AbstractClientConnector
        Returns the shared state for this connector.
        Overrides:
        getState in class AbstractDateField<java.time.LocalDate,​com.vaadin.shared.ui.datefield.DateResolution>
        Parameters:
        markAsDirty - true if the connector should automatically be marked dirty, false otherwise
        Returns:
        The shared state for this connector. Never null.
        See Also:
        AbstractClientConnector.getState()
      • convertFromDate

        protected java.time.LocalDate convertFromDate​(java.util.Date date)
        Description copied from class: AbstractDateField
        Converts Date to date type T.
        Specified by:
        convertFromDate in class AbstractDateField<java.time.LocalDate,​com.vaadin.shared.ui.datefield.DateResolution>
        Parameters:
        date - a date to convert
        Returns:
        object of type T representing the date
      • convertToDate

        protected java.util.Date convertToDate​(java.time.LocalDate date)
        Description copied from class: AbstractDateField
        Converts the object of type T to Date.

        This is the opposite to AbstractDateField.convertFromDate(Date).

        Specified by:
        convertToDate in class AbstractDateField<java.time.LocalDate,​com.vaadin.shared.ui.datefield.DateResolution>
        Parameters:
        date - the date of type T
        Returns:
        converted date of type Date
      • adjustToResolution

        protected java.time.LocalDate adjustToResolution​(java.time.LocalDate date,
                                                         com.vaadin.shared.ui.datefield.DateResolution forResolution)
        Description copied from class: AbstractDateField
        Adjusts the given date to the given resolution. Any values that are more specific than the given resolution are truncated to their default values.
        Specified by:
        adjustToResolution in class AbstractDateField<java.time.LocalDate,​com.vaadin.shared.ui.datefield.DateResolution>
        Parameters:
        date - the date to adjust, can be null
        forResolution - the resolution to be used in the adjustment, can be null
        Returns:
        an adjusted date that matches the given resolution, or null if the given date, resolution, or both were null
      • formatDate

        protected java.lang.String formatDate​(java.time.LocalDate value)
        Description copied from class: AbstractDateField
        Formats date according to the components locale.
        Specified by:
        formatDate in class AbstractDateField<java.time.LocalDate,​com.vaadin.shared.ui.datefield.DateResolution>
        Parameters:
        value - the date or null
        Returns:
        textual representation of the date or empty string for null
      • toType

        protected java.time.LocalDate toType​(java.time.temporal.TemporalAccessor temporalAccessor)
        Description copied from class: AbstractDateField
        Converts a temporal value into field-specific data type.
        Specified by:
        toType in class AbstractDateField<java.time.LocalDate,​com.vaadin.shared.ui.datefield.DateResolution>
        Parameters:
        temporalAccessor - - source value
        Returns:
        conversion result.
      • handleUnparsableDateString

        protected Result<java.time.LocalDate> handleUnparsableDateString​(java.lang.String dateString)
        Description copied from class: AbstractDateField
        This method is called to handle a non-empty date string from the client if the client could not parse it as a Date. By default, an error result is returned whose error message is AbstractDateField.getParseErrorMessage(). This can be overridden to handle conversions, to return a result with null value (equivalent to empty input) or to return a custom error.
        Overrides:
        handleUnparsableDateString in class AbstractDateField<java.time.LocalDate,​com.vaadin.shared.ui.datefield.DateResolution>
        Parameters:
        dateString - date string to handle
        Returns:
        result that contains parsed Date as a value or an error