|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
public class DateBox
A text box that shows a DatePicker
when the user focuses on it.
DateBox.DefaultFormat
when the text does not represent a date that
can be parsed
public class DateBoxExample implements EntryPoint { public void onModuleLoad() { DateBox dateBox = new DateBox(); dateBox.setValue(new Date()); RootPanel.get().add(dateBox); } }
Nested Class Summary | |
---|---|
static class |
DateBox.DefaultFormat
Default DateBox.Format class. |
static interface |
DateBox.Format
Implemented by a delegate to handle the parsing and formating of date values. |
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_STYLENAME
Default style name. |
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
Constructor Summary | |
---|---|
DateBox()
Create a date box with a new DatePicker . |
|
DateBox(DatePicker picker,
java.util.Date date,
DateBox.Format format)
Create a new date box. |
Method Summary | |
---|---|
HandlerRegistration |
addValueChangeHandler(ValueChangeHandler<java.util.Date> handler)
Adds a ValueChangeEvent handler. |
LeafValueEditor<java.util.Date> |
asEditor()
Returns a TakesValueEditor backed by the DateBox. |
int |
getCursorPos()
Gets the current cursor position in the date box. |
DatePicker |
getDatePicker()
Gets the date picker. |
boolean |
getFireNullValues()
Returns true iff the date box will fire ValueChangeEvents with a
date value of null for invalid or empty string values. |
DateBox.Format |
getFormat()
Gets the format instance used to control formatting and parsing of this DateBox . |
int |
getTabIndex()
Gets the date box's position in the tab index. |
TextBox |
getTextBox()
Get text box. |
java.util.Date |
getValue()
Get the date displayed, or null if the text box is empty, or cannot be interpreted. |
void |
hideDatePicker()
Hide the date picker. |
boolean |
isDatePickerShowing()
Returns true if date picker is currently showing, false if not. |
boolean |
isEnabled()
Returns true if the date box is enabled, false if not. |
void |
setAccessKey(char key)
Sets the date box's 'access key'. |
void |
setEnabled(boolean enabled)
Sets whether the date box is enabled. |
void |
setFireNullValues(boolean fireNullValues)
Sets whether or not the date box will fire ValueChangeEvents with a
date value of null for invalid or empty string values. |
void |
setFocus(boolean focused)
Explicitly focus/unfocus this widget. |
void |
setFormat(DateBox.Format format)
Sets the format used to control formatting and parsing of dates in this DateBox . |
void |
setTabIndex(int index)
Sets the date box's position in the tab index. |
void |
setValue(java.util.Date date)
Set the date. |
void |
setValue(java.util.Date date,
boolean fireEvents)
Sets this object's value. |
void |
showDatePicker()
Parses the current date box's value and shows that date. |
Methods inherited from class com.google.gwt.user.client.ui.Composite |
---|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
addAttachHandler, 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.UIObject |
---|
addStyleDependentName, 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.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Field Detail |
---|
public static final java.lang.String DEFAULT_STYLENAME
Constructor Detail |
---|
public DateBox()
DatePicker
.
public DateBox(DatePicker picker, java.util.Date date, DateBox.Format format)
date
- the default date.picker
- the picker to drop down from the date boxformat
- to use to parse and format datesMethod Detail |
---|
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<java.util.Date> handler)
HasValueChangeHandlers
ValueChangeEvent
handler.
addValueChangeHandler
in interface HasValueChangeHandlers<java.util.Date>
handler
- the handler
public LeafValueEditor<java.util.Date> asEditor()
TakesValueEditor
backed by the DateBox.
asEditor
in interface IsEditor<LeafValueEditor<java.util.Date>>
Editor
of type Epublic int getCursorPos()
public DatePicker getDatePicker()
public boolean getFireNullValues()
ValueChangeEvents
with a
date value of null
for invalid or empty string values.
public DateBox.Format getFormat()
DateBox
.
public int getTabIndex()
public TextBox getTextBox()
public java.util.Date getValue()
getValue
in interface TakesValue<java.util.Date>
getValue
in interface HasValue<java.util.Date>
TakesValue.setValue(V)
public void hideDatePicker()
public boolean isDatePickerShowing()
public boolean isEnabled()
isEnabled
in interface HasEnabled
public void setAccessKey(char key)
key
- the date box's access keypublic void setEnabled(boolean enabled)
setEnabled
in interface HasEnabled
enabled
- is the box enabledpublic void setFireNullValues(boolean fireNullValues)
ValueChangeEvents
with a
date value of null
for invalid or empty string values.
public void setFocus(boolean focused)
focused
- whether this widget should take focus or release itpublic void setFormat(DateBox.Format format)
DateBox
. If this DateBox
is not empty, the contents of date
box will be replaced with current contents in the new format.
format
- the new date formatpublic void setTabIndex(int index)
-1
will cause this widget to
be removed from the tab order.
index
- the date box's tab indexpublic void setValue(java.util.Date date)
setValue
in interface TakesValue<java.util.Date>
setValue
in interface HasValue<java.util.Date>
date
- the object's new valueTakesValue.getValue()
public void setValue(java.util.Date date, boolean fireEvents)
HasValue
ValueChangeEvent
when
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.
setValue
in interface HasValue<java.util.Date>
date
- the object's new valuefireEvents
- fire events if true and value is newpublic void showDatePicker()
|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |