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 forLocalDate
type.- 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 emptyAbstractLocalDateField
with no caption.AbstractLocalDateField(String caption)
Constructs an emptyAbstractLocalDateField
with caption.AbstractLocalDateField(String caption, LocalDate value)
Constructs a newAbstractLocalDateField
with the given caption and initial text contents.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected LocalDate
adjustToResolution(LocalDate date, DateResolution forResolution)
Adjusts the given date to the given resolution.protected LocalDate
buildDate(Map<DateResolution,Integer> resolutionValues)
Builds date by the givenresolutionValues
which is a map whose keys are resolution and integer values.protected LocalDate
convertFromDate(Date date)
ConvertsDate
to date typeT
.protected Date
convertToDate(LocalDate date)
Converts the object of typeT
toDate
.protected String
formatDate(LocalDate value)
Formats date according to the components locale.protected int
getDatePart(LocalDate date, DateResolution resolution)
Returns a date integer value part for the givendate
for the givenresolution
.protected RangeValidator<LocalDate>
getRangeValidator()
Returns a custom date range validator which is applicable for the typeT
.protected AbstractTextualDateFieldState
getState()
Returns the shared state bean with information to be sent from the server to the client.protected AbstractTextualDateFieldState
getState(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 LocalDate
toType(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 emptyAbstractLocalDateField
with no caption.
-
AbstractLocalDateField
public AbstractLocalDateField(String caption)
Constructs an emptyAbstractLocalDateField
with caption.- Parameters:
caption
- the caption of the datefield.
-
-
Method Detail
-
getDatePart
protected int getDatePart(LocalDate date, DateResolution resolution)
Description copied from class:AbstractDateField
Returns a date integer value part for the givendate
for the givenresolution
.- Specified by:
getDatePart
in classAbstractDateField<LocalDate,DateResolution>
- Parameters:
date
- the given date, can benull
resolution
- 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:AbstractDateField
Builds date by the givenresolutionValues
which is a map whose keys are resolution and integer values.This is the opposite to
AbstractDateField.getDatePart(Temporal, Enum)
.- Specified by:
buildDate
in 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:AbstractDateField
Returns a custom date range validator which is applicable for the typeT
.- Specified by:
getRangeValidator
in classAbstractDateField<LocalDate,DateResolution>
- Returns:
- the date range validator
-
getState
protected 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 classAbstractDateField<LocalDate,DateResolution>
- Returns:
- updated component shared state
-
getState
protected AbstractTextualDateFieldState getState(boolean markAsDirty)
Description copied from class:AbstractClientConnector
Returns the shared state for this connector.- Overrides:
getState
in 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:AbstractDateField
ConvertsDate
to date typeT
.- Specified by:
convertFromDate
in classAbstractDateField<LocalDate,DateResolution>
- Parameters:
date
- a date to convert- Returns:
- object of type
T
representing thedate
-
convertToDate
protected Date convertToDate(LocalDate date)
Description copied from class:AbstractDateField
Converts the object of typeT
toDate
.This is the opposite to
AbstractDateField.convertFromDate(Date)
.- Specified by:
convertToDate
in 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: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 classAbstractDateField<LocalDate,DateResolution>
- Parameters:
date
- the date to adjust, can benull
forResolution
- the resolution to be used in the adjustment, can benull
- Returns:
- an adjusted date that matches the given resolution, or
null
if the given date, resolution, or both werenull
-
formatDate
protected String formatDate(LocalDate value)
Description copied from class:AbstractDateField
Formats date according to the components locale.- Specified by:
formatDate
in 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:AbstractDateField
Converts a temporal value into field-specific data type.- Specified by:
toType
in classAbstractDateField<LocalDate,DateResolution>
- Parameters:
temporalAccessor
- - source value- Returns:
- conversion result.
-
handleUnparsableDateString
protected Result<LocalDate> handleUnparsableDateString(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 isAbstractDateField.getParseErrorMessage()
. This can be overridden to handle conversions, to return a result withnull
value (equivalent to empty input) or to return a custom error.- Overrides:
handleUnparsableDateString
in classAbstractDateField<LocalDate,DateResolution>
- Parameters:
dateString
- date string to handle- Returns:
- result that contains parsed Date as a value or an error
-
-