com.vaadin.ui.
Class AbstractLocalDateTimeField
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.ui.AbstractComponent
-
- com.vaadin.ui.AbstractField<T>
-
- com.vaadin.ui.AbstractDateField<LocalDateTime,DateTimeResolution>
-
- com.vaadin.ui.AbstractLocalDateTimeField
-
All Implemented Interfaces:
HasValue<LocalDateTime>
,ContextClickEvent.ContextClickNotifier
,FieldEvents.BlurNotifier
,FieldEvents.FocusNotifier
,MethodEventSource
,ClientConnector
,Sizeable
,Connector
,Component
,Component.Focusable
,Serializable
Direct Known Subclasses:
public abstract class AbstractLocalDateTimeField extends AbstractDateField<LocalDateTime,DateTimeResolution>
Abstract DateField class for
LocalDateTime
type.Since:
8.0
Author:
Vaadin Ltd
See Also:
-
-
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 AbstractLocalDateTimeField()
Constructs an empty
AbstractLocalDateTimeField
with no caption.AbstractLocalDateTimeField(String caption)
Constructs an empty
AbstractLocalDateTimeField
with caption.AbstractLocalDateTimeField(String caption, LocalDateTime value)
Constructs a new
AbstractLocalDateTimeField
with the given caption and initial text contents.
-
Method Summary
All Methods Modifier and Type Method Description protected LocalDateTime
adjustToResolution(LocalDateTime date, DateTimeResolution forResolution)
Adjusts the given date to the given resolution.
protected LocalDateTime
buildDate(Map<DateTimeResolution,Integer> resolutionValues)
Builds date by the given
resolutionValues
which is a map whose keys are resolution and integer values.protected LocalDateTime
convertFromDate(Date date)
Converts
Date
to date typeT
.protected Date
convertToDate(LocalDateTime date)
Converts the object of type
T
toDate
.protected String
formatDate(LocalDateTime value)
Formats date according to the components locale.
protected int
getDatePart(LocalDateTime date, DateTimeResolution resolution)
Returns a date integer value part for the given
date
for the givenresolution
.protected RangeValidator<LocalDateTime>
getRangeValidator()
Returns a custom date range validator which is applicable for the type
T
.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 LocalDateTime
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, handleUnparsableDateString, 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
-
AbstractLocalDateTimeField
public AbstractLocalDateTimeField()
Constructs an empty
AbstractLocalDateTimeField
with no caption.
-
AbstractLocalDateTimeField
public AbstractLocalDateTimeField(String caption)
Constructs an empty
AbstractLocalDateTimeField
with caption.Parameters:
caption
- the caption of the datefield.
-
AbstractLocalDateTimeField
public AbstractLocalDateTimeField(String caption, LocalDateTime value)
Constructs a new
AbstractLocalDateTimeField
with the given caption and initial text contents.Parameters:
caption
- the captionString
for the editor.value
- the LocalDateTime value.
-
-
Method Detail
-
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<LocalDateTime,DateTimeResolution>
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<LocalDateTime,DateTimeResolution>
Parameters:
markAsDirty
- true if the connector should automatically be marked dirty, false otherwiseReturns:
The shared state for this connector. Never null.
See Also:
-
getDatePart
protected int getDatePart(LocalDateTime date, DateTimeResolution resolution)
Description copied from class:
AbstractDateField
Returns a date integer value part for the given
date
for the givenresolution
.Specified by:
getDatePart
in classAbstractDateField<LocalDateTime,DateTimeResolution>
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
-
getRangeValidator
protected RangeValidator<LocalDateTime> getRangeValidator()
Description copied from class:
AbstractDateField
Returns a custom date range validator which is applicable for the type
T
.Specified by:
getRangeValidator
in classAbstractDateField<LocalDateTime,DateTimeResolution>
Returns:
the date range validator
-
buildDate
protected LocalDateTime buildDate(Map<DateTimeResolution,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 classAbstractDateField<LocalDateTime,DateTimeResolution>
Parameters:
resolutionValues
- date values to construct a dateReturns:
date built from the given map of date values
-
convertFromDate
protected LocalDateTime convertFromDate(Date date)
Description copied from class:
AbstractDateField
Converts
Date
to date typeT
.Specified by:
convertFromDate
in classAbstractDateField<LocalDateTime,DateTimeResolution>
Parameters:
date
- a date to convertReturns:
object of type
T
representing thedate
-
convertToDate
protected Date convertToDate(LocalDateTime date)
Description copied from class:
AbstractDateField
Converts the object of type
T
toDate
.This is the opposite to
AbstractDateField.convertFromDate(Date)
.Specified by:
convertToDate
in classAbstractDateField<LocalDateTime,DateTimeResolution>
Parameters:
date
- the date of typeT
Returns:
converted date of type
Date
-
adjustToResolution
protected LocalDateTime adjustToResolution(LocalDateTime date, DateTimeResolution 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<LocalDateTime,DateTimeResolution>
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(LocalDateTime value)
Description copied from class:
AbstractDateField
Formats date according to the components locale.
Specified by:
formatDate
in classAbstractDateField<LocalDateTime,DateTimeResolution>
Parameters:
value
- the date ornull
Returns:
textual representation of the date or empty string for
null
-
toType
protected LocalDateTime toType(TemporalAccessor temporalAccessor)
Description copied from class:
AbstractDateField
Converts a temporal value into field-specific data type.
Specified by:
toType
in classAbstractDateField<LocalDateTime,DateTimeResolution>
Parameters:
temporalAccessor
- - source valueReturns:
conversion result.
-
-