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
-
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description VDateField(R resolution)
Constructs a widget for a date field.
-
Method Summary
All Methods Modifier and Type Method 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
andbufferedResolutions
to the server, and clears their values.void
sendBufferedValuesWithDelay()
Puts the
bufferedDateString
andbufferedResolutions
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
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
getWidget, getWidgetCount, getWidgetIndex, remove
-
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
getWidgetIndex
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
CLASSNAME
public static final String CLASSNAME
Default classname for this widget.
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
Currently used locale string, e.g.
en_US
.
-
readonly
protected boolean readonly
Is the widget read-only or not.
-
enabled
protected boolean enabled
Is the widget enabled or not.
-
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
Should ISO 8601 week numbers be shown in the date selector or not.
-
-
Constructor Detail
-
VDateField
public VDateField(R resolution)
Constructs a widget for a date field.
Parameters:
resolution
- the resolution for this widget (day, month, ...)
-
-
Method Detail
-
getCurrentResolution
public R getCurrentResolution()
Returns the current resolution.
Returns:
the resolution
-
setCurrentResolution
public void setCurrentResolution(R currentResolution)
Sets the resolution.
Parameters:
currentResolution
- the new resolution
-
getCurrentLocale
public String getCurrentLocale()
Returns the current locale String.
Returns:
the locale String
-
setCurrentLocale
public void setCurrentLocale(String currentLocale)
Sets the locale String.
Parameters:
currentLocale
- the new locale String.
-
getCurrentDate
public Date getCurrentDate()
Returns the current date value.
Returns:
the date value
-
setCurrentDate
public void setCurrentDate(Date date)
Sets the date value.
Parameters:
date
- the new date value
-
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
- a map from resolutions to date valuesSince:
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()
Returns whether this widget is read-only or not.
Returns:
true
if read-only,false
otherwise
-
setReadonly
public void setReadonly(boolean readonly)
Sets whether this widget should be read-only or not.
Parameters:
readonly
-true
if read-only,false
otherwise
-
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()
Returns the date time service for this widget.
Returns:
the date time service
-
getId
@Deprecated public String getId()
Deprecated.This method is not used by the framework code anymore.Returns the connector id that corresponds with this widget.
Returns:
the connector id
-
getClient
public ApplicationConnection getClient()
Returns the current application connection.
Returns:
the application connection
-
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)
Sets 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.
Parameters:
showISOWeekNumbers
-true
if week number should be shown,false
otherwise
-
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
-
sendBufferedValuesWithDelay
public void sendBufferedValuesWithDelay()
Puts the
bufferedDateString
andbufferedResolutions
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.Since:
8.9
-
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:
-
-