com.vaadin.client.ui.
Class VDateField<R extends Enum<R>>
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.Panel
-
- com.google.gwt.user.client.ui.ComplexPanel
-
- com.google.gwt.user.client.ui.FlowPanel
-
- com.vaadin.client.ui.VDateField<R>
-
Type Parameters:
R
- the resolution type which this field is based on (day, month, ...)All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasEnabled, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.HasWidgets.ForIsWidget, com.google.gwt.user.client.ui.IndexedPanel, com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget, com.google.gwt.user.client.ui.InsertPanel, com.google.gwt.user.client.ui.InsertPanel.ForIsWidget, com.google.gwt.user.client.ui.IsWidget, Field, Iterable<com.google.gwt.user.client.ui.Widget>
Direct Known Subclasses:
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
A very base widget class for a date field.
Author:
Vaadin Ltd
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
-
-
Field Summary
Fields 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 Summary
Constructors Constructor and Description VDateField(R resolution)
-
Method Summary
All Methods 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
andbufferedResolutions
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
andbufferedResolutions
that will be sent to the server.-
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
-
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, doAttachChildren, doDetachChildren, orphan, remove
-
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
-
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, 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, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
getWidgetIndex
-
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel
getWidget, getWidgetCount, getWidgetIndex, remove
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
CLASSNAME
public static final String CLASSNAME
See Also:
-
client
public ApplicationConnection client
For internal use only. May be removed or replaced in the future.
-
connector
public AbstractDateFieldConnector<R extends Enum<R>> connector
For internal use only. May be removed or replaced in the future.
-
currentLocale
protected String currentLocale
-
readonly
protected boolean readonly
-
enabled
protected boolean enabled
-
rpc
public AbstractDateFieldServerRpc rpc
The RPC send calls to the server.
Since:
8.2
-
bufferedResolutions
protected Map<R extends Enum<R>,Integer> bufferedResolutions
A temporary holder of the time units (resolutions), which would be sent to the server through
sendBufferedValues()
. The key is the resolution. The value can benull
.Since:
8.2
-
bufferedDateString
protected String bufferedDateString
A temporary holder of the date string, which would be sent to the server through
sendBufferedValues()
.Since:
8.2
-
dts
public DateTimeService dts
For internal use only. May be removed or replaced in the future.
-
showISOWeekNumbers
protected boolean showISOWeekNumbers
-
-
Constructor Detail
-
VDateField
public VDateField(R resolution)
-
-
Method Detail
-
getCurrentResolution
public R getCurrentResolution()
-
setCurrentResolution
public void setCurrentResolution(R currentResolution)
-
getCurrentLocale
public String getCurrentLocale()
-
setCurrentLocale
public void setCurrentLocale(String currentLocale)
-
getCurrentDate
public Date getCurrentDate()
-
setCurrentDate
public void setCurrentDate(Date date)
-
setDefaultDate
public void setDefaultDate(Date date)
Set the default date to open popup when no date is selected.
Parameters:
date
- default date to show as the initial (non-selected) value when opening a popup with no value selectedSince:
8.1.2
-
setCurrentDate
public void setCurrentDate(Map<R,Integer> dateValues)
Set the current date using a map with date values.
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)
Parameters:
dateValues
- a map with date values to convert into a date
-
setDefaultDate
public void setDefaultDate(Map<R,Integer> defaultValues)
Set the default date using a map with date values.
Parameters:
defaultValues
-Since:
8.1.2
See Also:
-
getDefaultDate
public Date getDefaultDate()
Sets the default date when no date is selected.
Returns:
the default date
Since:
8.1.2
-
isReadonly
public boolean isReadonly()
-
setReadonly
public void setReadonly(boolean readonly)
-
isEnabled
public boolean isEnabled()
Specified by:
isEnabled
in interfacecom.google.gwt.user.client.ui.HasEnabled
-
setEnabled
public void setEnabled(boolean enabled)
Specified by:
setEnabled
in interfacecom.google.gwt.user.client.ui.HasEnabled
-
getDateTimeService
public DateTimeService getDateTimeService()
-
getId
public String getId()
-
getClient
public ApplicationConnection getClient()
-
isShowISOWeekNumbers
public boolean isShowISOWeekNumbers()
Returns whether ISO 8601 week numbers should be shown in the date selector or not. ISO 8601 defines that a week always starts with a Monday so the week numbers are only shown if this is the case.
Returns:
true if week number should be shown, false otherwise
-
setShowISOWeekNumbers
public void setShowISOWeekNumbers(boolean showISOWeekNumbers)
-
getDate
public Date getDate()
Returns a copy of the current date. Modifying the returned date will not modify the value of this VDateField. Use
setDate(Date)
to change the current date.For internal use only. May be removed or replaced in the future.
Returns:
A copy of the current date
-
setDate
protected void setDate(Date date)
Sets the current date for this VDateField.
Parameters:
date
- The new date to use
-
getResolutionVariable
public String getResolutionVariable(R resolution)
Returns a resolution variable name for the given
resolution
.Parameters:
resolution
- the given resolutionReturns:
the resolution variable name
-
updateBufferedValues
public abstract void updateBufferedValues()
Update buffered values
bufferedDateString
andbufferedResolutions
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.
Since:
8.4
-
sendBufferedValues
public void sendBufferedValues()
Sends the
bufferedDateString
andbufferedResolutions
to the server, and clears their values.Since:
8.2
-
getResolutions
public Stream<R> getResolutions()
Returns all available resolutions for the field in the ascending order (which is the same as order of enumeration ordinals).
The method uses
doGetResolutions()
to make sure that the order is the correct one.Returns:
stream of all available resolutions in the ascending order.
See Also:
-
resolutionAsString
public abstract String resolutionAsString()
Returns a current resolution as a string.
The method is used to generate a style name for the current resolution.
Returns:
the current resolution as a string
-
isYear
public abstract boolean isYear(R resolution)
Checks whether the given
resolution
represents an year.Parameters:
resolution
- the given resolutionReturns:
true
if theresolution
represents an year
-
supportsTime
protected abstract boolean supportsTime()
Checks whether time is supported by this widget.
Returns:
true
if time is supported in addition to date,false
if only dates are supportedSince:
8.1
-
getDate
protected abstract Date getDate(Map<R,Integer> dateValues)
Returns a date based on the provided date values map.
Parameters:
dateValues
- a map with date values to convert into a dateReturns:
the date based on the dateValues map
See Also:
-
doGetResolutions
protected abstract R[] doGetResolutions()
Returns all available resolutions as an array.
No any order is required (in contrary to
getResolutions()
.Returns:
all available resolutions
See Also:
-
-