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 |
ApplicationConnection |
client
For internal use only.
|
AbstractDateFieldConnector<R> |
connector
For internal use only.
|
protected String |
currentLocale |
DateTimeService |
dts
For internal use only.
|
protected boolean |
enabled |
protected boolean |
readonly |
AbstractDateFieldServerRpc |
rpc
The RPC send calls to the server.
|
protected boolean |
showISOWeekNumbers |
| Constructor and Description |
|---|
VDateField(R resolution) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract R[] |
doGetResolutions()
Returns all available resolutions as an array.
|
ApplicationConnection |
getClient() |
Date |
getCurrentDate() |
String |
getCurrentLocale() |
R |
getCurrentResolution() |
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() |
Date |
getDefaultDate()
Sets the default date when no date is selected.
|
String |
getId() |
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() |
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 |
setCurrentDate(Date date) |
void |
setCurrentDate(Map<R,Integer> dateValues)
Set the current date using a map with date values.
|
void |
setCurrentLocale(String currentLocale) |
void |
setCurrentResolution(R currentResolution) |
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) |
void |
setShowISOWeekNumbers(boolean showISOWeekNumbers) |
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
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)
public R getCurrentResolution()
public void setCurrentResolution(R currentResolution)
public String getCurrentLocale()
public void setCurrentLocale(String currentLocale)
public Date getCurrentDate()
public void setCurrentDate(Date date)
public 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 - setCurrentDate(Map)public Date getDefaultDate()
public boolean isReadonly()
public void setReadonly(boolean readonly)
public 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()
public String getId()
public ApplicationConnection getClient()
public boolean isShowISOWeekNumbers()
public void setShowISOWeekNumbers(boolean showISOWeekNumbers)
public 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 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 © 2018 Vaadin Ltd. All rights reserved.