Class VAbstractTextualDate<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>
-
- com.vaadin.client.ui.VAbstractTextualDate<R>
-
- Type Parameters:
R- the resolution type which this field is based on (day, month, ...)
- All Implemented Interfaces:
com.google.gwt.event.dom.client.ChangeHandler,com.google.gwt.event.dom.client.KeyDownHandler,com.google.gwt.event.logical.shared.HasAttachHandlers,com.google.gwt.event.shared.EventHandler,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,Focusable,HandlesAriaCaption,HandlesAriaInvalid,HandlesAriaRequired,Field,SubPartAware,Iterable<com.google.gwt.user.client.ui.Widget>
- Direct Known Subclasses:
VAbstractPopupCalendar
public abstract class VAbstractTextualDate<R extends Enum<R>> extends VDateField<R> implements com.google.gwt.event.dom.client.ChangeHandler, Focusable, SubPartAware, HandlesAriaCaption, HandlesAriaInvalid, HandlesAriaRequired, com.google.gwt.event.dom.client.KeyDownHandler
Abstract textual date field base implementation. Provides a text box as an editor for a date. The class is parameterized by the date resolution enumeration type.- Since:
- 8.0
- 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 booleanlenientFor internal use only.com.google.gwt.user.client.ui.TextBoxtextFor internal use only.-
Fields inherited from class com.vaadin.client.ui.VDateField
bufferedDateString, bufferedResolutions, CLASSNAME, client, connector, currentLocale, dts, enabled, readonly, rpc, showISOWeekNumbers
-
-
Constructor Summary
Constructors Constructor Description VAbstractTextualDate(R resoluton)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbindAriaCaption(com.google.gwt.user.client.Element captionElement)Called to bind the provided caption (label in HTML speak) element to the main input element of the Widget.voidbuildDate()Updates the text field according to the current date (provided byVDateField.getDate()).protected voidcheckGroupFocus(boolean textFocus)Checks if the group focus has changed, and sends to the server if needed.protected StringcleanFormat(String format)Clean date format string to make it suitable forgetFormatString().protected StringcreateFormatString()Create a format string suitable for the widget in its current state.voidfocus()Sets focus to this widget.StringgetFormatString()Gets the date format string for the current locale.StringgetISODate()Gets the value of the date field as a locale independent ISO date (yyyy-MM-dd'T'HH:mm:ss or yyyy-MM-dd depending on whether this is a date field or a date and time field).StringgetPlaceHolder()Gets the set placeholder this textual date input, or an empty string if none is set.com.google.gwt.user.client.ElementgetSubPartElement(String subPart)Locates an element inside a component using the identifier provided insubPart.StringgetSubPartName(com.google.gwt.user.client.Element subElement)Provides an identifier that identifies the element within the component.protected StringgetText()protected booleanhasChildFocus()Returns whether any of the child components has focus.voidonChange(com.google.gwt.event.dom.client.ChangeEvent event)voidonKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event)voidsetAriaInvalid(boolean invalid)Called to set the element, typically an input element, as invalid.voidsetAriaRequired(boolean required)Called to set the element, typically an input element, as required.voidsetEnabled(boolean enabled)voidsetFormatString(String formatString)Sets the date format string to use for the text field.voidsetISODate(String isoDate)Sets the value of the date field as a locale independent ISO date (yyyy-MM-dd'T'HH:mm:ss or yyyy-MM-dd depending on whether this is a date field or a date and time field).voidsetPlaceholder(String placeholder)Sets the placeholder for this textual date input.protected voidsetText(String text)voidsetTimeZone(com.google.gwt.i18n.client.TimeZone timeZone)Sets the time zone for the field.protected voidupdateAndSendBufferedValues()Deprecated.UseupdateBufferedResolutions()andVDateField.sendBufferedValues()instead.protected voidupdateBufferedResolutions()UpdatesbufferedResolutionsbefore sending a response to the server.voidupdateBufferedValues()Update buffered valuesVDateField.bufferedDateStringandVDateField.bufferedResolutionsthat will be sent to the server.protected voidupdateStyleNames()Updates style names for the widget (and its children).-
Methods inherited from class com.vaadin.client.ui.VDateField
doGetResolutions, getClient, getCurrentDate, getCurrentLocale, getCurrentResolution, getDate, getDate, getDateTimeService, getDefaultDate, getId, getResolutions, getResolutionVariable, isEnabled, isReadonly, isShowISOWeekNumbers, isYear, resolutionAsString, sendBufferedValues, sendBufferedValuesWithDelay, setCurrentDate, setCurrentDate, setCurrentLocale, setCurrentResolution, setDate, setDefaultDate, setDefaultDate, setReadonly, setShowISOWeekNumbers, supportsTime
-
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
-
-
-
-
Constructor Detail
-
VAbstractTextualDate
public VAbstractTextualDate(R resoluton)
-
-
Method Detail
-
updateStyleNames
protected void updateStyleNames()
Updates style names for the widget (and its children).
-
getFormatString
public String getFormatString()
Gets the date format string for the current locale.- Returns:
- the format string
-
createFormatString
protected String createFormatString()
Create a format string suitable for the widget in its current state.- Returns:
- a date format string to use when formatting and parsing the text in the input field
- Since:
- 8.1
-
setFormatString
public void setFormatString(String formatString)
Sets the date format string to use for the text field.- Parameters:
formatString- the format string to use, ornullto force re-creating the format string from the locale the next time it is needed- Since:
- 8.1
-
bindAriaCaption
public void bindAriaCaption(com.google.gwt.user.client.Element captionElement)
Description copied from interface:HandlesAriaCaptionCalled to bind the provided caption (label in HTML speak) element to the main input element of the Widget. Binding should be removed from the main input field when captionElement is null.- Specified by:
bindAriaCaptionin interfaceHandlesAriaCaption- Parameters:
captionElement- Element of the caption
-
setAriaRequired
public void setAriaRequired(boolean required)
Description copied from interface:HandlesAriaRequiredCalled to set the element, typically an input element, as required.- Specified by:
setAriaRequiredin interfaceHandlesAriaRequired- Parameters:
required- boolean true when the element needs to be set as required
-
setAriaInvalid
public void setAriaInvalid(boolean invalid)
Description copied from interface:HandlesAriaInvalidCalled to set the element, typically an input element, as invalid.- Specified by:
setAriaInvalidin interfaceHandlesAriaInvalid- Parameters:
invalid- boolean, true when the element should be marked invalid, false otherwise
-
buildDate
public void buildDate()
Updates the text field according to the current date (provided byVDateField.getDate()). Takes care of updating text, enabling and disabling the field, setting/removing readonly status and updating readonly styles.For internal use only. May be removed or replaced in the future.
TODO: Split part of this into a method that only updates the text as this is what usually is needed except for updateFromUIDL.
-
setTimeZone
public void setTimeZone(com.google.gwt.i18n.client.TimeZone timeZone)
Sets the time zone for the field.- Parameters:
timeZone- the new time zone to use- Since:
- 8.2
-
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabledin interfacecom.google.gwt.user.client.ui.HasEnabled- Overrides:
setEnabledin classVDateField<R extends Enum<R>>
-
onChange
public void onChange(com.google.gwt.event.dom.client.ChangeEvent event)
- Specified by:
onChangein interfacecom.google.gwt.event.dom.client.ChangeHandler
-
updateBufferedValues
public void updateBufferedValues()
Description copied from class:VDateFieldUpdate buffered valuesVDateField.bufferedDateStringandVDateField.bufferedResolutionsthat 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.
- Specified by:
updateBufferedValuesin classVDateField<R extends Enum<R>>
-
updateAndSendBufferedValues
@Deprecated protected final void updateAndSendBufferedValues()
Deprecated.UseupdateBufferedResolutions()andVDateField.sendBufferedValues()instead.Updates thebufferedResolutions, thensendsthe values to the server.- Since:
- 8.2
-
updateBufferedResolutions
protected void updateBufferedResolutions()
UpdatesbufferedResolutionsbefore sending a response to the server.The method can be overridden by subclasses to provide a custom logic for date variables to avoid overriding the
onChange(ChangeEvent)method.Note that this method should not send the buffered values. For that, use
VDateField.sendBufferedValues().- Since:
- 8.2
-
cleanFormat
protected String cleanFormat(String format)
Clean date format string to make it suitable forgetFormatString().- Parameters:
format- date format string- Returns:
- cleaned up string
- See Also:
getFormatString()
-
focus
public void focus()
Description copied from interface:FocusableSets focus to this widget.
-
setPlaceholder
public void setPlaceholder(String placeholder)
Sets the placeholder for this textual date input.- Parameters:
placeholder- the placeholder to set, ornullto clear
-
getPlaceHolder
public String getPlaceHolder()
Gets the set placeholder this textual date input, or an empty string if none is set.- Returns:
- the placeholder or an empty string if none set
-
getText
protected String getText()
-
setText
protected void setText(String text)
-
getSubPartElement
public com.google.gwt.user.client.Element getSubPartElement(String subPart)
Description copied from interface:SubPartAwareLocates an element inside a component using the identifier provided insubPart. ThesubPartidentifier is component specific and may be any string of characters, numbers, space characters and brackets.- Specified by:
getSubPartElementin interfaceSubPartAware- Parameters:
subPart- The identifier for the element inside the component- Returns:
- The element identified by subPart or null if the element could not be found.
-
getSubPartName
public String getSubPartName(com.google.gwt.user.client.Element subElement)
Description copied from interface:SubPartAwareProvides an identifier that identifies the element within the component. ThesubElementis a part of the component and must never be null.Note!
getSubPartElement(getSubPartName(element)) == elementis not always true. A component can choose to provide a more generic identifier for any given element if the results of all interactions withsubElementare the same as interactions with the element identified by the return value. For example a button can return an identifier for the root element even though a DIV inside the button was passed assubElementbecause interactions with the DIV and the root button element produce the same result.- Specified by:
getSubPartNamein interfaceSubPartAware- Parameters:
subElement- The element the identifier string should uniquely identify- Returns:
- An identifier that uniquely identifies
subElementor null if no identifier could be provided.
-
onKeyDown
public void onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event)
- Specified by:
onKeyDownin interfacecom.google.gwt.event.dom.client.KeyDownHandler
-
checkGroupFocus
protected void checkGroupFocus(boolean textFocus)
Checks if the group focus has changed, and sends to the server if needed.- Parameters:
textFocus- the focus of thetext- Since:
- 8.3
-
hasChildFocus
protected boolean hasChildFocus()
Returns whether any of the child components has focus.- Returns:
trueif any of the child component has focus,falseotherwise- Since:
- 8.3
-
setISODate
public void setISODate(String isoDate)
Sets the value of the date field as a locale independent ISO date (yyyy-MM-dd'T'HH:mm:ss or yyyy-MM-dd depending on whether this is a date field or a date and time field).- Parameters:
isoDate- the date to set in ISO8601 format, or null to clear the date value- Since:
- 8.1
-
getISODate
public String getISODate()
Gets the value of the date field as a locale independent ISO date (yyyy-MM-dd'T'HH:mm:ss or yyyy-MM-dd depending on whether this is a date field or a date and time field).- Returns:
- the current date in ISO8601 format, or null if no date is set
- Since:
- 8.1
-
-