R - the resolution type which this field is based on (day, month, ...)public abstract class VDateField<R extends Enum<R>> extends com.google.gwt.user.client.ui.FlowPanel implements Field, com.google.gwt.user.client.ui.HasEnabled
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled| Modifier and Type | Field and Description |
|---|---|
protected String |
bufferedDateString
A temporary holder of the date string, which would be sent to the server
through
sendBufferedValues(). |
protected Map<R,Integer> |
bufferedResolutions
A temporary holder of the time units (resolutions), which would be sent
to the server through
sendBufferedValues(). |
static String |
CLASSNAME
Default classname for this widget.
|
ApplicationConnection |
client
For internal use only.
|
AbstractDateFieldConnector<R> |
connector
For internal use only.
|
protected String |
currentLocale
Currently used locale string, e.g.
|
DateTimeService |
dts
For internal use only.
|
protected boolean |
enabled
Is the widget enabled or not.
|
protected boolean |
readonly
Is the widget read-only or not.
|
AbstractDateFieldServerRpc |
rpc
The RPC send calls to the server.
|
protected boolean |
showISOWeekNumbers
Should ISO 8601 week numbers be shown in the date selector or not.
|
| Constructor and Description |
|---|
VDateField(R resolution)
Constructs a widget for a date field.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract R[] |
doGetResolutions()
Returns all available resolutions as an array.
|
ApplicationConnection |
getClient()
Returns the current application connection.
|
Date |
getCurrentDate()
Returns the current date value.
|
String |
getCurrentLocale()
Returns the current locale String.
|
R |
getCurrentResolution()
Returns the current resolution.
|
Date |
getDate()
Returns a copy of the current date.
|
protected abstract Date |
getDate(Map<R,Integer> dateValues)
Returns a date based on the provided date values map.
|
DateTimeService |
getDateTimeService()
Returns the date time service for this widget.
|
Date |
getDefaultDate()
Sets the default date when no date is selected.
|
String |
getId()
Deprecated.
This method is not used by the framework code anymore.
|
Stream<R> |
getResolutions()
Returns all available resolutions for the field in the ascending order
(which is the same as order of enumeration ordinals).
|
String |
getResolutionVariable(R resolution)
Returns a resolution variable name for the given
resolution. |
boolean |
isEnabled() |
boolean |
isReadonly()
Returns whether this widget is read-only or not.
|
boolean |
isShowISOWeekNumbers()
Returns whether ISO 8601 week numbers should be shown in the date
selector or not.
|
abstract boolean |
isYear(R resolution)
Checks whether the given
resolution represents an year. |
abstract String |
resolutionAsString()
Returns a current resolution as a string.
|
void |
sendBufferedValues()
Sends the
bufferedDateString and bufferedResolutions to
the server, and clears their values. |
void |
sendBufferedValuesWithDelay()
Puts the
bufferedDateString and bufferedResolutions
changes into the rpc queue and clears their values. |
void |
setCurrentDate(Date date)
Sets the date value.
|
void |
setCurrentDate(Map<R,Integer> dateValues)
Set the current date using a map with date values.
|
void |
setCurrentLocale(String currentLocale)
Sets the locale String.
|
void |
setCurrentResolution(R currentResolution)
Sets the resolution.
|
protected void |
setDate(Date date)
Sets the current date for this VDateField.
|
void |
setDefaultDate(Date date)
Set the default date to open popup when no date is selected.
|
void |
setDefaultDate(Map<R,Integer> defaultValues)
Set the default date using a map with date values.
|
void |
setEnabled(boolean enabled) |
void |
setReadonly(boolean readonly)
Sets whether this widget should be read-only or not.
|
void |
setShowISOWeekNumbers(boolean showISOWeekNumbers)
Sets whether ISO 8601 week numbers should be shown in the date selector
or not.
|
protected abstract boolean |
supportsTime()
Checks whether time is supported by this widget.
|
abstract void |
updateBufferedValues()
Update buffered values
bufferedDateString and
bufferedResolutions that will be sent to the server. |
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, removeadd, adopt, doAttachChildren, doDetachChildren, orphan, removeaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetWidgetIndexgetWidget, getWidgetCount, getWidgetIndex, removeforEach, spliteratorpublic static final String CLASSNAME
public ApplicationConnection client
public AbstractDateFieldConnector<R extends Enum<R>> connector
protected String currentLocale
en_US.protected boolean readonly
protected boolean enabled
public AbstractDateFieldServerRpc rpc
protected Map<R extends Enum<R>,Integer> bufferedResolutions
sendBufferedValues().
The key is the resolution.
The value can be null.protected String bufferedDateString
sendBufferedValues().public DateTimeService dts
protected boolean showISOWeekNumbers
public VDateField(R resolution)
resolution - the resolution for this widget (day, month, ...)public R getCurrentResolution()
public void setCurrentResolution(R currentResolution)
currentResolution - the new resolutionpublic String getCurrentLocale()
public void setCurrentLocale(String currentLocale)
currentLocale - the new locale String.public Date getCurrentDate()
public void setCurrentDate(Date date)
date - the new date valuepublic void setDefaultDate(Date date)
date - default date to show as the initial (non-selected) value when
opening a popup with no value selectedpublic void setCurrentDate(Map<R,Integer> dateValues)
The map contains integer representation of values per resolution. The
method should construct a date based on the map and set it via
setCurrentDate(Date)
dateValues - a map with date values to convert into a datepublic void setDefaultDate(Map<R,Integer> defaultValues)
defaultValues - a map from resolutions to date valuessetCurrentDate(Map)public Date getDefaultDate()
public boolean isReadonly()
true if read-only, false otherwisepublic void setReadonly(boolean readonly)
readonly - true if read-only, false otherwisepublic boolean isEnabled()
isEnabled in interface com.google.gwt.user.client.ui.HasEnabledpublic void setEnabled(boolean enabled)
setEnabled in interface com.google.gwt.user.client.ui.HasEnabledpublic DateTimeService getDateTimeService()
@Deprecated public String getId()
public ApplicationConnection getClient()
public boolean isShowISOWeekNumbers()
true if week number should be shown, false
otherwisepublic void setShowISOWeekNumbers(boolean showISOWeekNumbers)
showISOWeekNumbers - true if week number should be shown, false
otherwisepublic Date getDate()
setDate(Date) to change
the current date.
For internal use only. May be removed or replaced in the future.
protected void setDate(Date date)
date - The new date to usepublic String getResolutionVariable(R resolution)
resolution.resolution - the given resolutionpublic abstract void updateBufferedValues()
bufferedDateString and
bufferedResolutions that will be sent to the server.
This method should NOT send values to the server.
This method can be implemented by subclasses to update buffered values from component values.
public void sendBufferedValues()
bufferedDateString and bufferedResolutions to
the server, and clears their values.public void sendBufferedValuesWithDelay()
bufferedDateString and bufferedResolutions
changes into the rpc queue and clears their values.
Note: The value will not be sent to the server immediately. It will be
sent when a non Delayed annotated
rpc is triggered.
public Stream<R> getResolutions()
The method uses doGetResolutions() to make sure that the order
is the correct one.
doGetResolutions()public abstract String resolutionAsString()
The method is used to generate a style name for the current resolution.
public abstract boolean isYear(R resolution)
resolution represents an year.resolution - the given resolutiontrue if the resolution represents an yearprotected abstract boolean supportsTime()
true if time is supported in addition to date,
false if only dates are supportedprotected abstract Date getDate(Map<R,Integer> dateValues)
dateValues - a map with date values to convert into a datesetCurrentDate(Map)protected abstract R[] doGetResolutions()
No any order is required (in contrary to getResolutions().
getResolutions()Copyright © 2023 Vaadin Ltd. All rights reserved.