Class DateBox
- java.lang.Object
- 
- com.google.gwt.user.client.ui.UIObject
- 
- com.google.gwt.user.client.ui.Widget
- 
- com.google.gwt.user.client.ui.Composite
- 
- com.google.gwt.user.datepicker.client.DateBox
 
 
 
 
- 
- All Implemented Interfaces:
- IsEditor<LeafValueEditor<java.util.Date>>,- HasAttachHandlers,- HasValueChangeHandlers<java.util.Date>,- HasHandlers,- EventListener,- TakesValue<java.util.Date>,- HasEnabled,- HasValue<java.util.Date>,- HasVisibility,- IsRenderable,- IsWidget
 
 public class DateBox extends Composite implements HasEnabled, HasValue<java.util.Date>, IsEditor<LeafValueEditor<java.util.Date>> A text box that shows aDatePickerwhen the user focuses on it.CSS Style Rules- .gwt-DateBox
- default style name
- .dateBoxPopup
- Applied to the popup around the DatePicker
- .dateBoxFormatError
- Default style for when the date box has bad input. Applied by
 DateBox.DefaultFormatwhen the text does not represent a date that can be parsed
 Examplepublic class DateBoxExample implements EntryPoint { public void onModuleLoad() { DateBox dateBox = new DateBox(); dateBox.setValue(new Date()); RootPanel.get().add(dateBox); } }
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classDateBox.DefaultFormatDefaultDateBox.Formatclass.static interfaceDateBox.FormatImplemented by a delegate to handle the parsing and formating of date values.- 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObjectUIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.StringDEFAULT_STYLENAMEDefault style name.- 
Fields inherited from class com.google.gwt.user.client.ui.UIObjectDEBUG_ID_PREFIX
 
- 
 - 
Constructor SummaryConstructors Constructor Description DateBox()Create a date box with a newDatePicker.DateBox(DatePicker picker, java.util.Date date, DateBox.Format format)Create a new date box.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description HandlerRegistrationaddValueChangeHandler(ValueChangeHandler<java.util.Date> handler)Adds aValueChangeEventhandler.LeafValueEditor<java.util.Date>asEditor()Returns aTakesValueEditorbacked by the DateBox.intgetCursorPos()Gets the current cursor position in the date box.DatePickergetDatePicker()Gets the date picker.booleangetFireNullValues()Returns true iff the date box will fireValueChangeEventswith a date value ofnullfor invalid or empty string values.DateBox.FormatgetFormat()Gets the format instance used to control formatting and parsing of thisDateBox.intgetTabIndex()Gets the date box's position in the tab index.TextBoxgetTextBox()Get text box.java.util.DategetValue()Get the date displayed, or null if the text box is empty, or cannot be interpreted.voidhideDatePicker()Hide the date picker.booleanisDatePickerShowing()Returns true if date picker is currently showing, false if not.booleanisEnabled()Returns true if the date box is enabled, false if not.voidsetAccessKey(char key)Sets the date box's 'access key'.voidsetEnabled(boolean enabled)Sets whether the date box is enabled.voidsetFireNullValues(boolean fireNullValues)Sets whether or not the date box will fireValueChangeEventswith a date value ofnullfor invalid or empty string values.voidsetFocus(boolean focused)Explicitly focus/unfocus this widget.voidsetFormat(DateBox.Format format)Sets the format used to control formatting and parsing of dates in thisDateBox.voidsetTabIndex(int index)Sets the date box's position in the tab index.voidsetValue(java.util.Date date)Set the date.voidsetValue(java.util.Date date, boolean fireEvents)Sets this object's value.voidshowDatePicker()Parses the current date box's value and shows that date.- 
Methods inherited from class com.google.gwt.user.client.ui.CompositeclaimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
 - 
Methods inherited from class com.google.gwt.user.client.ui.WidgetaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
 - 
Methods inherited from class com.google.gwt.user.client.ui.UIObjectaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface com.google.gwt.event.shared.HasHandlersfireEvent
 
- 
 
- 
- 
- 
Field Detail- 
DEFAULT_STYLENAMEpublic static final java.lang.String DEFAULT_STYLENAME Default style name.- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
DateBoxpublic DateBox() Create a date box with a newDatePicker.
 - 
DateBoxpublic DateBox(DatePicker picker, java.util.Date date, DateBox.Format format) Create a new date box.- Parameters:
- date- the default date.
- picker- the picker to drop down from the date box
- format- to use to parse and format dates
 
 
- 
 - 
Method Detail- 
addValueChangeHandlerpublic HandlerRegistration addValueChangeHandler(ValueChangeHandler<java.util.Date> handler) Description copied from interface:HasValueChangeHandlersAdds aValueChangeEventhandler.- Specified by:
- addValueChangeHandlerin interface- HasValueChangeHandlers<java.util.Date>
- Parameters:
- handler- the handler
- Returns:
- the registration for the event
 
 - 
asEditorpublic LeafValueEditor<java.util.Date> asEditor() Returns aTakesValueEditorbacked by the DateBox.- Specified by:
- asEditorin interface- IsEditor<LeafValueEditor<java.util.Date>>
- Returns:
- an Editorof type E
 
 - 
getCursorPospublic int getCursorPos() Gets the current cursor position in the date box.- Returns:
- the cursor position
 
 - 
getDatePickerpublic DatePicker getDatePicker() Gets the date picker.- Returns:
- the date picker
 
 - 
getFireNullValuespublic boolean getFireNullValues() Returns true iff the date box will fireValueChangeEventswith a date value ofnullfor invalid or empty string values.
 - 
getFormatpublic DateBox.Format getFormat() Gets the format instance used to control formatting and parsing of thisDateBox.- Returns:
- the format
 
 - 
getTabIndexpublic int getTabIndex() Gets the date box's position in the tab index.- Returns:
- the date box's tab index
 
 - 
getTextBoxpublic TextBox getTextBox() Get text box.- Returns:
- the text box used to enter the formatted date
 
 - 
getValuepublic java.util.Date getValue() Get the date displayed, or null if the text box is empty, or cannot be interpreted.- Specified by:
- getValuein interface- HasValue<java.util.Date>
- Specified by:
- getValuein interface- TakesValue<java.util.Date>
- Returns:
- the current date value
- See Also:
- TakesValue.setValue(V)
 
 - 
hideDatePickerpublic void hideDatePicker() Hide the date picker.
 - 
isDatePickerShowingpublic boolean isDatePickerShowing() Returns true if date picker is currently showing, false if not.
 - 
isEnabledpublic boolean isEnabled() Returns true if the date box is enabled, false if not.- Specified by:
- isEnabledin interface- HasEnabled
 
 - 
setAccessKeypublic void setAccessKey(char key) Sets the date box's 'access key'. This key is used (in conjunction with a browser-specific modifier key) to automatically focus the widget.- Parameters:
- key- the date box's access key
 
 - 
setEnabledpublic void setEnabled(boolean enabled) Sets whether the date box is enabled.- Specified by:
- setEnabledin interface- HasEnabled
- Parameters:
- enabled- is the box enabled
 
 - 
setFireNullValuespublic void setFireNullValues(boolean fireNullValues) Sets whether or not the date box will fireValueChangeEventswith a date value ofnullfor invalid or empty string values.
 - 
setFocuspublic void setFocus(boolean focused) Explicitly focus/unfocus this widget. Only one widget can have focus at a time, and the widget that does will receive all keyboard events.- Parameters:
- focused- whether this widget should take focus or release it
 
 - 
setFormatpublic void setFormat(DateBox.Format format) Sets the format used to control formatting and parsing of dates in thisDateBox. If thisDateBoxis not empty, the contents of date box will be replaced with current contents in the new format.- Parameters:
- format- the new date format
 
 - 
setTabIndexpublic void setTabIndex(int index) Sets the date box's position in the tab index. If more than one widget has the same tab index, each such widget will receive focus in an arbitrary order. Setting the tab index to-1will cause this widget to be removed from the tab order.- Parameters:
- index- the date box's tab index
 
 - 
setValuepublic void setValue(java.util.Date date) Set the date.- Specified by:
- setValuein interface- HasValue<java.util.Date>
- Specified by:
- setValuein interface- TakesValue<java.util.Date>
- Parameters:
- date- the object's new value
- See Also:
- TakesValue.getValue()
 
 - 
setValuepublic void setValue(java.util.Date date, boolean fireEvents)Description copied from interface:HasValueSets this object's value. FiresValueChangeEventwhen fireEvents is true and the new value does not equal the existing value.It is acceptable to fail assertions or throw (documented) unchecked exceptions in response to bad values. 
 - 
showDatePickerpublic void showDatePicker() Parses the current date box's value and shows that date.
 
- 
 
-