Package com.vaadin.ui
Class AbstractLocalDateField
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.ui.AbstractComponent
-
- com.vaadin.ui.AbstractField<T>
-
- com.vaadin.ui.AbstractDateField<LocalDate,DateResolution>
-
- com.vaadin.ui.AbstractLocalDateField
-
- All Implemented Interfaces:
HasValue<LocalDate>,ContextClickEvent.ContextClickNotifier,FieldEvents.BlurNotifier,FieldEvents.FocusNotifier,MethodEventSource,ClientConnector,Sizeable,Connector,Component,Component.Focusable,Serializable
- Direct Known Subclasses:
DateField,InlineDateField
public abstract class AbstractLocalDateField extends AbstractDateField<LocalDate,DateResolution>
Abstract DateField class forLocalDatetype.- Since:
- 8.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
-
Nested classes/interfaces inherited from interface com.vaadin.data.HasValue
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<V>
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
-
Field Summary
-
Fields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXT
-
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
-
-
Constructor Summary
Constructors Constructor Description AbstractLocalDateField()Constructs an emptyAbstractLocalDateFieldwith no caption.AbstractLocalDateField(String caption)Constructs an emptyAbstractLocalDateFieldwith caption.AbstractLocalDateField(String caption, LocalDate value)Constructs a newAbstractLocalDateFieldwith the given caption and initial text contents.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected LocalDateadjustToResolution(LocalDate date, DateResolution forResolution)Adjusts the given date to the given resolution.protected LocalDatebuildDate(Map<DateResolution,Integer> resolutionValues)Builds date by the givenresolutionValueswhich is a map whose keys are resolution and integer values.protected LocalDateconvertFromDate(Date date)ConvertsDateto date typeT.protected DateconvertToDate(LocalDate date)Converts the object of typeTtoDate.protected StringformatDate(LocalDate value)Formats date according to the components locale.protected intgetDatePart(LocalDate date, DateResolution resolution)Returns a date integer value part for the givendatefor the givenresolution.protected RangeValidator<LocalDate>getRangeValidator()Returns a custom date range validator which is applicable for the typeT.protected AbstractTextualDateFieldStategetState()Returns the shared state bean with information to be sent from the server to the client.protected AbstractTextualDateFieldStategetState(boolean markAsDirty)Returns the shared state for this connector.protected Result<LocalDate>handleUnparsableDateString(String dateString)This method is called to handle a non-empty date string from the client if the client could not parse it as a Date.protected LocalDatetoType(TemporalAccessor temporalAccessor)Converts a temporal value into field-specific data type.-
Methods inherited from class com.vaadin.ui.AbstractDateField
addBlurListener, addFocusListener, afterDate, beforeClientResponse, convertFromDateString, convertToDateString, doSetValue, getAssistiveLabel, getDateFormat, getDateOutOfRangeMessage, getDateStyle, getDateStyles, getDefaultValidator, getDefaultValue, getParseErrorMessage, getRangeEnd, getRangeStart, getResolution, getValue, getZoneId, isLenient, isPreventInvalidInput, isShowISOWeekNumbers, readDesign, reconstructDateFromFields, setAssistiveLabel, setDateFormat, setDateOutOfRangeMessage, setDateStyle, setDaylightSavingTimeRange, setDefaultValue, setLenient, setLocale, setParseErrorMessage, setPreventInvalidInput, setRangeEnd, setRangeStart, setResolution, setShowISOWeekNumbers, setValue, setZoneId, writeDesign
-
Methods inherited from class com.vaadin.ui.AbstractField
addValueChangeListener, createValueChange, focus, getCustomAttributes, getTabIndex, isDifferentValue, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible, setTabIndex, setValue
-
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidth, setWidthFull, setWidthUndefined
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.data.HasValue
clear, getEmptyValue, getOptionalValue, isEmpty
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull, setWidthUndefined
-
-
-
-
Constructor Detail
-
AbstractLocalDateField
public AbstractLocalDateField()
Constructs an emptyAbstractLocalDateFieldwith no caption.
-
AbstractLocalDateField
public AbstractLocalDateField(String caption)
Constructs an emptyAbstractLocalDateFieldwith caption.- Parameters:
caption- the caption of the datefield.
-
-
Method Detail
-
getDatePart
protected int getDatePart(LocalDate date, DateResolution resolution)
Description copied from class:AbstractDateFieldReturns a date integer value part for the givendatefor the givenresolution.- Specified by:
getDatePartin classAbstractDateField<LocalDate,DateResolution>- Parameters:
date- the given date, can benullresolution- the resolution to extract a value from the date by, notnull- Returns:
- the integer value part of the date by the given resolution
-
buildDate
protected LocalDate buildDate(Map<DateResolution,Integer> resolutionValues)
Description copied from class:AbstractDateFieldBuilds date by the givenresolutionValueswhich is a map whose keys are resolution and integer values.This is the opposite to
AbstractDateField.getDatePart(Temporal, Enum).- Specified by:
buildDatein classAbstractDateField<LocalDate,DateResolution>- Parameters:
resolutionValues- date values to construct a date- Returns:
- date built from the given map of date values
-
getRangeValidator
protected RangeValidator<LocalDate> getRangeValidator()
Description copied from class:AbstractDateFieldReturns a custom date range validator which is applicable for the typeT.- Specified by:
getRangeValidatorin classAbstractDateField<LocalDate,DateResolution>- Returns:
- the date range validator
-
getState
protected AbstractTextualDateFieldState getState()
Description copied from class:AbstractComponentReturns 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:
getStatein classAbstractDateField<LocalDate,DateResolution>- Returns:
- updated component shared state
-
getState
protected AbstractTextualDateFieldState getState(boolean markAsDirty)
Description copied from class:AbstractClientConnectorReturns the shared state for this connector.- Overrides:
getStatein classAbstractDateField<LocalDate,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 LocalDate convertFromDate(Date date)
Description copied from class:AbstractDateFieldConvertsDateto date typeT.- Specified by:
convertFromDatein classAbstractDateField<LocalDate,DateResolution>- Parameters:
date- a date to convert- Returns:
- object of type
Trepresenting thedate
-
convertToDate
protected Date convertToDate(LocalDate date)
Description copied from class:AbstractDateFieldConverts the object of typeTtoDate.This is the opposite to
AbstractDateField.convertFromDate(Date).- Specified by:
convertToDatein classAbstractDateField<LocalDate,DateResolution>- Parameters:
date- the date of typeT- Returns:
- converted date of type
Date
-
adjustToResolution
protected LocalDate adjustToResolution(LocalDate date, DateResolution forResolution)
Description copied from class:AbstractDateFieldAdjusts 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:
adjustToResolutionin classAbstractDateField<LocalDate,DateResolution>- Parameters:
date- the date to adjust, can benullforResolution- the resolution to be used in the adjustment, can benull- Returns:
- an adjusted date that matches the given resolution, or
nullif the given date, resolution, or both werenull
-
formatDate
protected String formatDate(LocalDate value)
Description copied from class:AbstractDateFieldFormats date according to the components locale.- Specified by:
formatDatein classAbstractDateField<LocalDate,DateResolution>- Parameters:
value- the date ornull- Returns:
- textual representation of the date or empty string for
null
-
toType
protected LocalDate toType(TemporalAccessor temporalAccessor)
Description copied from class:AbstractDateFieldConverts a temporal value into field-specific data type.- Specified by:
toTypein classAbstractDateField<LocalDate,DateResolution>- Parameters:
temporalAccessor- - source value- Returns:
- conversion result.
-
handleUnparsableDateString
protected Result<LocalDate> handleUnparsableDateString(String dateString)
Description copied from class:AbstractDateFieldThis 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 isAbstractDateField.getParseErrorMessage(). This can be overridden to handle conversions, to return a result withnullvalue (equivalent to empty input) or to return a custom error.- Overrides:
handleUnparsableDateStringin classAbstractDateField<LocalDate,DateResolution>- Parameters:
dateString- date string to handle- Returns:
- result that contains parsed Date as a value or an error
-
-