Package 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:
DateTimeField,InlineDateTimeField
public abstract class AbstractLocalDateTimeField extends AbstractDateField<LocalDateTime,DateTimeResolution>
Abstract DateField class forLocalDateTimetype.- 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 AbstractLocalDateTimeField()Constructs an emptyAbstractLocalDateTimeFieldwith no caption.AbstractLocalDateTimeField(String caption)Constructs an emptyAbstractLocalDateTimeFieldwith caption.AbstractLocalDateTimeField(String caption, LocalDateTime value)Constructs a newAbstractLocalDateTimeFieldwith the given caption and initial text contents.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected LocalDateTimeadjustToResolution(LocalDateTime date, DateTimeResolution forResolution)Adjusts the given date to the given resolution.protected LocalDateTimebuildDate(Map<DateTimeResolution,Integer> resolutionValues)Builds date by the givenresolutionValueswhich is a map whose keys are resolution and integer values.protected LocalDateTimeconvertFromDate(Date date)ConvertsDateto date typeT.protected DateconvertToDate(LocalDateTime date)Converts the object of typeTtoDate.protected StringformatDate(LocalDateTime value)Formats date according to the components locale.protected intgetDatePart(LocalDateTime date, DateTimeResolution resolution)Returns a date integer value part for the givendatefor the givenresolution.protected RangeValidator<LocalDateTime>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 LocalDateTimetoType(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 emptyAbstractLocalDateTimeFieldwith no caption.
-
AbstractLocalDateTimeField
public AbstractLocalDateTimeField(String caption)
Constructs an emptyAbstractLocalDateTimeFieldwith caption.- Parameters:
caption- the caption of the datefield.
-
AbstractLocalDateTimeField
public AbstractLocalDateTimeField(String caption, LocalDateTime value)
Constructs a newAbstractLocalDateTimeFieldwith the given caption and initial text contents.- Parameters:
caption- the captionStringfor the editor.value- the LocalDateTime value.
-
-
Method Detail
-
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<LocalDateTime,DateTimeResolution>- 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<LocalDateTime,DateTimeResolution>- 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()
-
getDatePart
protected int getDatePart(LocalDateTime date, DateTimeResolution resolution)
Description copied from class:AbstractDateFieldReturns a date integer value part for the givendatefor the givenresolution.- Specified by:
getDatePartin classAbstractDateField<LocalDateTime,DateTimeResolution>- 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
-
getRangeValidator
protected RangeValidator<LocalDateTime> getRangeValidator()
Description copied from class:AbstractDateFieldReturns a custom date range validator which is applicable for the typeT.- Specified by:
getRangeValidatorin classAbstractDateField<LocalDateTime,DateTimeResolution>- Returns:
- the date range validator
-
buildDate
protected LocalDateTime buildDate(Map<DateTimeResolution,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<LocalDateTime,DateTimeResolution>- Parameters:
resolutionValues- date values to construct a date- Returns:
- date built from the given map of date values
-
convertFromDate
protected LocalDateTime convertFromDate(Date date)
Description copied from class:AbstractDateFieldConvertsDateto date typeT.- Specified by:
convertFromDatein classAbstractDateField<LocalDateTime,DateTimeResolution>- Parameters:
date- a date to convert- Returns:
- object of type
Trepresenting thedate
-
convertToDate
protected Date convertToDate(LocalDateTime date)
Description copied from class:AbstractDateFieldConverts the object of typeTtoDate.This is the opposite to
AbstractDateField.convertFromDate(Date).- Specified by:
convertToDatein 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: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<LocalDateTime,DateTimeResolution>- 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(LocalDateTime value)
Description copied from class:AbstractDateFieldFormats date according to the components locale.- Specified by:
formatDatein 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:AbstractDateFieldConverts a temporal value into field-specific data type.- Specified by:
toTypein classAbstractDateField<LocalDateTime,DateTimeResolution>- Parameters:
temporalAccessor- - source value- Returns:
- conversion result.
-
-