Class DateField
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.ui.AbstractComponent
-
- com.vaadin.ui.AbstractField<Date>
-
- com.vaadin.ui.DateField
-
- All Implemented Interfaces:
Buffered,BufferedValidatable,Property<Date>,Property.Editor,Property.ReadOnlyStatusChangeListener,Property.ReadOnlyStatusChangeNotifier,Property.ValueChangeListener,Property.ValueChangeNotifier,Property.Viewer,Validatable,Action.ShortcutNotifier,ConnectorEventListener,ContextClickEvent.ContextClickNotifier,FieldEvents.BlurNotifier,FieldEvents.FocusNotifier,MethodEventSource,ClientConnector,Sizeable,VariableOwner,Connector,Component,Component.Focusable,Field<Date>,LegacyComponent,Serializable,EventListener
- Direct Known Subclasses:
InlineDateField,PopupDateField
public class DateField extends AbstractField<Date> implements FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, LegacyComponent
A date editor component that can be bound to any
Propertythat is compatible withjava.util.Date.Since
DateFieldextendsAbstractFieldit implements theBufferedinterface.A
DateFieldis in write-through mode by default, soAbstractField#setWriteThrough(boolean)must be called to enable buffering.- Since:
- 3.0
- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDateField.UnparsableDateString-
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent
-
Nested classes/interfaces inherited from interface com.vaadin.data.Buffered
Buffered.SourceException
-
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.ui.Field
Field.ValueChangeEvent
-
Nested classes/interfaces inherited from interface com.vaadin.data.Property
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
-
Field Summary
Fields Modifier and Type Field Description static ResolutionRESOLUTION_DAYDeprecated.As of 7.0, useResolution.DAYstatic ResolutionRESOLUTION_HOURDeprecated.As of 7.0, useResolution.HOURstatic ResolutionRESOLUTION_MINDeprecated.As of 7.0, useResolution.MINUTEstatic ResolutionRESOLUTION_MONTHDeprecated.As of 7.0, useResolution.MONTHstatic ResolutionRESOLUTION_SECDeprecated.As of 7.0, useResolution.SECONDstatic ResolutionRESOLUTION_YEARDeprecated.As of 7.0, useResolution.YEAR-
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 DateField()Constructs an emptyDateFieldwith no caption.DateField(Property dataSource)Constructs a newDateFieldthat's bound to the specifiedPropertyand has no caption.DateField(String caption)Constructs an emptyDateFieldwith caption.DateField(String caption, Property dataSource)Constructs a newDateFieldthat's bound to the specifiedPropertyand has the given captionString.DateField(String caption, Date value)Constructs a newDateFieldwith the given caption and initial text contents.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddBlurListener(FieldEvents.BlurListener listener)Adds aBlurListenerto the Component which gets fired when aFieldloses keyboard focus.voidaddFocusListener(FieldEvents.FocusListener listener)Adds aFocusListenerto the Component which gets fired when aFieldreceives keyboard focus.voidaddListener(FieldEvents.BlurListener listener)Deprecated.As of 7.0, replaced byaddBlurListener(BlurListener)voidaddListener(FieldEvents.FocusListener listener)Deprecated.As of 7.0, replaced byaddFocusListener(FocusListener)voidchangeVariables(Object source, Map<String,Object> variables)Called when one or more variables handled by the implementing class are changed.voiddiscard()Discards all changes since last commit.protected voidfireValueChange(boolean repaintIsNotNeeded)Emits the value change event.StringgetDateFormat()Returns a format string used to format date value on client side or null if default formatting fromComponent.getLocale()is used.StringgetDateOutOfRangeMessage()Returns current date-out-of-range error message.StringgetParseErrorMessage()Return the error message that is shown if the user inputted value can't be parsed into a Date object.DategetRangeEnd()Returns the precise rangeEnd used.DategetRangeStart()Returns the precise rangeStart used.ResolutiongetResolution()Gets the resolution.protected TextualDateFieldStategetState()Returns the shared state bean with information to be sent from the server to the client.protected TextualDateFieldStategetState(boolean markAsDirty)Returns the shared state for this connector.TimeZonegetTimeZone()Gets the time zone used by this field.Class<Date>getType()Returns the type of the Field.protected DatehandleUnparsableDateString(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.booleanisLenient()Returns whether date/time interpretation is to be lenient.booleanisShowISOWeekNumbers()Checks whether ISO 8601 week numbers are shown in the date selector.voidpaintContent(PaintTarget target)Paints the Paintable into a UIDL stream.voidreadDesign(org.jsoup.nodes.Element design, DesignContext designContext)Reads the component state from the given design.voidremoveBlurListener(FieldEvents.BlurListener listener)Removes aBlurListenerfrom the Component.voidremoveFocusListener(FieldEvents.FocusListener listener)Removes aFocusListenerfrom the Component.voidremoveListener(FieldEvents.BlurListener listener)Deprecated.As of 7.0, replaced byremoveBlurListener(BlurListener)voidremoveListener(FieldEvents.FocusListener listener)Deprecated.As of 7.0, replaced byremoveFocusListener(FocusListener)voidsetDateFormat(String dateFormat)Sets formatting used by some component implementations.voidsetDateOutOfRangeMessage(String dateOutOfRangeMessage)Sets the current error message if the range validation fails.protected voidsetInternalValue(Date newValue)Sets the internal field value.voidsetLenient(boolean lenient)Specifies whether or not date/time interpretation in component is to be lenient.voidsetParseErrorMessage(String parsingErrorMessage)Sets the default error message used if the DateField cannot parse the text input by user to a Date field.voidsetRangeEnd(Date endDate)Sets the end range for this component.voidsetRangeStart(Date startDate)Sets the start range for this component.voidsetResolution(Resolution resolution)Sets the resolution of the DateField.voidsetShowISOWeekNumbers(boolean showWeekNumbers)Sets the visibility of ISO 8601 week numbers in the date selector.voidsetTimeZone(TimeZone timeZone)Sets the time zone used by this date field.protected voidsetValue(Date newValue, boolean repaintIsNotNeeded)Sets the value of the field.protected booleanshouldHideErrors()Returns true if the error indicator be hidden when painting the component even when there are errors.voidvalidate()Validates the current value against registered validators if the field is not empty.voidwriteDesign(org.jsoup.nodes.Element design, DesignContext designContext)Writes the component state to the given design.-
Methods inherited from class com.vaadin.ui.AbstractField
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, attach, beforeClientResponse, clear, commit, detach, fireReadOnlyStatusChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getCustomAttributes, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getTabIndex, getValidators, getValue, isBuffered, isEmpty, isImmediate, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInvalidAllowed, setInvalidCommitted, setLocale, setPropertyDataSource, setReadOnly, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, setValue, toString, validate, valueChange
-
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getExplicitImmediateValue, 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, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidth, setWidthUndefined
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, 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, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.vaadin.event.Action.ShortcutNotifier
addShortcutListener, removeShortcutListener
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.ui.LegacyComponent
markAsDirty
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined
-
Methods inherited from interface com.vaadin.server.VariableOwner
isEnabled, isImmediate
-
-
-
-
Field Detail
-
RESOLUTION_SEC
@Deprecated public static final Resolution RESOLUTION_SEC
Deprecated.As of 7.0, useResolution.SECONDResolution identifier: seconds.
-
RESOLUTION_MIN
@Deprecated public static final Resolution RESOLUTION_MIN
Deprecated.As of 7.0, useResolution.MINUTEResolution identifier: minutes.
-
RESOLUTION_HOUR
@Deprecated public static final Resolution RESOLUTION_HOUR
Deprecated.As of 7.0, useResolution.HOURResolution identifier: hours.
-
RESOLUTION_DAY
@Deprecated public static final Resolution RESOLUTION_DAY
Deprecated.As of 7.0, useResolution.DAYResolution identifier: days.
-
RESOLUTION_MONTH
@Deprecated public static final Resolution RESOLUTION_MONTH
Deprecated.As of 7.0, useResolution.MONTHResolution identifier: months.
-
RESOLUTION_YEAR
@Deprecated public static final Resolution RESOLUTION_YEAR
Deprecated.As of 7.0, useResolution.YEARResolution identifier: years.
-
-
Constructor Detail
-
DateField
public DateField()
Constructs an emptyDateFieldwith no caption.
-
DateField
public DateField(String caption)
Constructs an emptyDateFieldwith caption.- Parameters:
caption- the caption of the datefield.
-
DateField
public DateField(String caption, Property dataSource)
Constructs a newDateFieldthat's bound to the specifiedPropertyand has the given captionString.- Parameters:
caption- the captionStringfor the editor.dataSource- the Property to be edited with this editor.
-
DateField
public DateField(Property dataSource) throws IllegalArgumentException
Constructs a newDateFieldthat's bound to the specifiedPropertyand has no caption.- Parameters:
dataSource- the Property to be edited with this editor.- Throws:
IllegalArgumentException
-
DateField
public DateField(String caption, Date value)
Constructs a newDateFieldwith the given caption and initial text contents. The editor constructed this way will not be bound to a Property unlessProperty.Viewer.setPropertyDataSource(Property)is called to bind it.- Parameters:
caption- the captionStringfor the editor.value- the Date value.
-
-
Method Detail
-
paintContent
public void paintContent(PaintTarget target) throws PaintException
Description copied from interface:LegacyComponentPaints the Paintable into a UIDL stream. This method creates the UIDL sequence describing it and outputs it to the given UIDL stream.
It is called when the contents of the component should be painted in response to the component first being shown or having been altered so that its visual representation is changed.
- Specified by:
paintContentin interfaceLegacyComponent- Parameters:
target- the target UIDL stream where the component should paint itself to.- Throws:
PaintException- if the paint operation failed.
-
shouldHideErrors
protected boolean shouldHideErrors()
Description copied from class:AbstractFieldReturns true if the error indicator be hidden when painting the component even when there are errors. This is a mostly internal method, but can be overridden in subclasses e.g. if the error indicator should also be shown for empty fields in some cases.- Overrides:
shouldHideErrorsin classAbstractField<Date>- Returns:
- true to hide the error indicator, false to use the normal logic to show it when there are errors
-
getState
protected TextualDateFieldState 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 classAbstractField<Date>- Returns:
- updated component shared state
-
getState
protected TextualDateFieldState getState(boolean markAsDirty)
Description copied from class:AbstractClientConnectorReturns the shared state for this connector.- Overrides:
getStatein classAbstractField<Date>- 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()
-
setRangeStart
public void setRangeStart(Date startDate)
Sets the start range for this component. If the value is set before this date (taking the resolution into account), the component will not validate. IfstartDateis set tonull, any value beforeendDatewill be accepted by the range- Parameters:
startDate- - the allowed range's start date
-
setDateOutOfRangeMessage
public void setDateOutOfRangeMessage(String dateOutOfRangeMessage)
Sets the current error message if the range validation fails.- Parameters:
dateOutOfRangeMessage- - Localizable message which is shown when value (the date) is set outside allowed range
-
setRangeEnd
public void setRangeEnd(Date endDate)
Sets the end range for this component. If the value is set after this date (taking the resolution into account), the component will not validate. IfendDateis set tonull, any value afterstartDatewill be accepted by the range.- Parameters:
endDate- - the allowed range's end date (inclusive, based on the current resolution)
-
getRangeStart
public Date getRangeStart()
Returns the precise rangeStart used.- Parameters:
startDate-
-
getRangeEnd
public Date getRangeEnd()
Returns the precise rangeEnd used.- Parameters:
startDate-
-
changeVariables
public void changeVariables(Object source, Map<String,Object> variables)
Description copied from interface:VariableOwnerCalled when one or more variables handled by the implementing class are changed.- Specified by:
changeVariablesin interfaceVariableOwner- Parameters:
source- the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.variables- the Mapping from variable names to new variable values.
-
discard
public void discard()
Description copied from interface:BufferedDiscards all changes since last commit. The object updates its value from the data source.- Specified by:
discardin interfaceBuffered- Overrides:
discardin classAbstractField<Date>
-
fireValueChange
protected void fireValueChange(boolean repaintIsNotNeeded)
Description copied from class:AbstractFieldEmits the value change event. The value contained in the field is validated before the event is created.- Overrides:
fireValueChangein classAbstractField<Date>
-
handleUnparsableDateString
protected Date handleUnparsableDateString(String dateString) throws Converter.ConversionException
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, a Converter.ConversionException is thrown, and the current value is not modified. This can be overridden to handle conversions, to return null (equivalent to empty input), to throw an exception or to fire an event.- Parameters:
dateString-- Returns:
- parsed Date
- Throws:
Converter.ConversionException- to keep the old value and indicate an error
-
getType
public Class<Date> getType()
Description copied from class:AbstractFieldReturns the type of the Field. The methodsgetValueandsetValuemust be compatible with this type: one must be able to safely cast the value returned fromgetValueto the given type and pass any variable assignable to this type as an argument tosetValue.
-
setValue
protected void setValue(Date newValue, boolean repaintIsNotNeeded) throws Property.ReadOnlyException
Description copied from class:AbstractFieldSets the value of the field.- Overrides:
setValuein classAbstractField<Date>- Parameters:
newValue- the New value of the field.repaintIsNotNeeded- True iff caller is sure that repaint is not needed.- Throws:
Property.ReadOnlyException
-
setInternalValue
protected void setInternalValue(Date newValue)
Description copied from class:AbstractFieldSets the internal field value. This is purely used by AbstractField to change the internal Field value. It does not trigger valuechange events. It can be overridden by the inheriting classes to update all dependent variables. Subclasses can also overrideAbstractField.getInternalValue()if necessary.- Overrides:
setInternalValuein classAbstractField<Date>- Parameters:
newValue- the new value to be set.
-
getResolution
public Resolution getResolution()
Gets the resolution.- Returns:
- int
-
setResolution
public void setResolution(Resolution resolution)
Sets the resolution of the DateField. The default resolution isResolution.DAYsince Vaadin 7.0.- Parameters:
resolution- the resolution to set.
-
setDateFormat
public void setDateFormat(String dateFormat)
Sets formatting used by some component implementations. SeeSimpleDateFormatfor format details. By default it is encouraged to used default formatting defined by Locale, but due some JVM bugs it is sometimes necessary to use this method to override formatting. See Vaadin issue #2200.- Parameters:
dateFormat- the dateFormat to set
-
getDateFormat
public String getDateFormat()
Returns a format string used to format date value on client side or null if default formatting fromComponent.getLocale()is used.- Returns:
- the dateFormat
-
setLenient
public void setLenient(boolean lenient)
Specifies whether or not date/time interpretation in component is to be lenient.- Parameters:
lenient- true if the lenient mode is to be turned on; false if it is to be turned off.- See Also:
Calendar.setLenient(boolean),isLenient()
-
isLenient
public boolean isLenient()
Returns whether date/time interpretation is to be lenient.- Returns:
- true if the interpretation mode of this calendar is lenient; false otherwise.
- See Also:
setLenient(boolean)
-
addFocusListener
public void addFocusListener(FieldEvents.FocusListener listener)
Description copied from interface:FieldEvents.FocusNotifierAdds aFocusListenerto the Component which gets fired when aFieldreceives keyboard focus.- Specified by:
addFocusListenerin interfaceFieldEvents.FocusNotifier- See Also:
FieldEvents.FocusListener
-
addListener
@Deprecated public void addListener(FieldEvents.FocusListener listener)
Deprecated.As of 7.0, replaced byaddFocusListener(FocusListener)- Specified by:
addListenerin interfaceFieldEvents.FocusNotifier
-
removeFocusListener
public void removeFocusListener(FieldEvents.FocusListener listener)
Description copied from interface:FieldEvents.FocusNotifierRemoves aFocusListenerfrom the Component.- Specified by:
removeFocusListenerin interfaceFieldEvents.FocusNotifier- See Also:
FieldEvents.FocusListener
-
removeListener
@Deprecated public void removeListener(FieldEvents.FocusListener listener)
Deprecated.As of 7.0, replaced byremoveFocusListener(FocusListener)- Specified by:
removeListenerin interfaceFieldEvents.FocusNotifier
-
addBlurListener
public void addBlurListener(FieldEvents.BlurListener listener)
Description copied from interface:FieldEvents.BlurNotifierAdds aBlurListenerto the Component which gets fired when aFieldloses keyboard focus.- Specified by:
addBlurListenerin interfaceFieldEvents.BlurNotifier- See Also:
FieldEvents.BlurListener
-
addListener
@Deprecated public void addListener(FieldEvents.BlurListener listener)
Deprecated.As of 7.0, replaced byaddBlurListener(BlurListener)- Specified by:
addListenerin interfaceFieldEvents.BlurNotifier
-
removeBlurListener
public void removeBlurListener(FieldEvents.BlurListener listener)
Description copied from interface:FieldEvents.BlurNotifierRemoves aBlurListenerfrom the Component.- Specified by:
removeBlurListenerin interfaceFieldEvents.BlurNotifier- See Also:
FieldEvents.BlurListener
-
removeListener
@Deprecated public void removeListener(FieldEvents.BlurListener listener)
Deprecated.As of 7.0, replaced byremoveBlurListener(BlurListener)- Specified by:
removeListenerin interfaceFieldEvents.BlurNotifier
-
isShowISOWeekNumbers
public boolean isShowISOWeekNumbers()
Checks whether ISO 8601 week numbers are shown in the date selector.- Returns:
- true if week numbers are shown, false otherwise.
-
setShowISOWeekNumbers
public void setShowISOWeekNumbers(boolean showWeekNumbers)
Sets the visibility of ISO 8601 week numbers in the date selector. ISO 8601 defines that a week always starts with a Monday so the week numbers are only shown if this is the case.- Parameters:
showWeekNumbers- true if week numbers should be shown, false otherwise.
-
validate
public void validate() throws Validator.InvalidValueExceptionValidates the current value against registered validators if the field is not empty. Note that DateField is considered empty (value == null) and invalid if it contains text typed in by the user that couldn't be parsed into a Date value.- Specified by:
validatein interfaceValidatable- Overrides:
validatein classAbstractField<Date>- Throws:
Validator.InvalidValueException- if the value is not valid- See Also:
AbstractField.validate()
-
getParseErrorMessage
public String getParseErrorMessage()
Return the error message that is shown if the user inputted value can't be parsed into a Date object. IfhandleUnparsableDateString(String)is overridden and it throws a custom exception, the message returned byThrowable.getLocalizedMessage()will be used instead of the value returned by this method.- Returns:
- the error message that the DateField uses when it can't parse the textual input from user to a Date object
- See Also:
setParseErrorMessage(String)
-
setParseErrorMessage
public void setParseErrorMessage(String parsingErrorMessage)
Sets the default error message used if the DateField cannot parse the text input by user to a Date field. Note that if thehandleUnparsableDateString(String)method is overridden, the localized message from its exception is used.- Parameters:
parsingErrorMessage-- See Also:
getParseErrorMessage(),handleUnparsableDateString(String)
-
setTimeZone
public void setTimeZone(TimeZone timeZone)
Sets the time zone used by this date field. The time zone is used to convert the absolute time in a Date object to a logical time displayed in the selector and to convert the select time back to a Date object. If no time zone has been set, the current default time zone returned byTimeZone.getDefault()is used.- Parameters:
timeZone- the time zone to use for time calculations.- See Also:
getTimeZone()
-
getTimeZone
public TimeZone getTimeZone()
Gets the time zone used by this field. The time zone is used to convert the absolute time in a Date object to a logical time displayed in the selector and to convert the select time back to a Date object. Ifnullis returned, the current default time zone returned byTimeZone.getDefault()is used.- Returns:
- the current time zone
-
readDesign
public void readDesign(org.jsoup.nodes.Element design, DesignContext designContext)Description copied from interface:ComponentReads the component state from the given design.The component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
- Specified by:
readDesignin interfaceComponent- Overrides:
readDesignin classAbstractField<Date>- Parameters:
design- The element to obtain the state fromdesignContext- The DesignContext instance used for parsing the design
-
writeDesign
public void writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)Description copied from interface:ComponentWrites the component state to the given design.The component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
- Specified by:
writeDesignin interfaceComponent- Overrides:
writeDesignin classAbstractField<Date>- Parameters:
design- The element to write the component state to. Any previous attributes or child nodes are not cleared.designContext- The DesignContext instance used for writing the design
-
getDateOutOfRangeMessage
public String getDateOutOfRangeMessage()
Returns current date-out-of-range error message.- Returns:
- Current error message for dates out of range.
- Since:
- 7.4
- See Also:
setDateOutOfRangeMessage(String)
-
-