Overview | Package | Class | Tree | Deprecated | Index | Help
| GWT 2.0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.user.datepicker.client
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:
  HasValueChangeHandlers<java.util.Date>, HasHandlers, EventListener, HasValue<java.util.Date>

    public class DateBox

extends Composite
implements HasValue<java.util.Date>

A text box that shows a `DatePicker` when 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.DefaultFormat` when the text does not represent a date that can be parsed

### Example

>     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.
`int` | `getCursorPos()` Gets the current cursor position in the date box.
`DatePicker` | `getDatePicker()` Gets the date picker.
`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()`
`void` | `setAccessKey(char key)` Sets the date box's 'access key'.
`void` | `setEnabled(boolean enabled)` Sets whether the date box is enabled.
`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
`getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`addDomHandler, addHandler, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents`

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, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents`

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

### DEFAULT_STYLENAME

    public static final java.lang.String DEFAULT_STYLENAME

  Default style name.

  See Also:
    Constant Field Values

Constructor Detail

### DateBox

    public DateBox()

  Create a date box with a new `DatePicker`.

### DateBox

    public 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

### addValueChangeHandler

    public HandlerRegistration addValueChangeHandler(ValueChangeHandler<java.util.Date> handler)

  Description copied from interface: `HasValueChangeHandlers`
  Adds a `ValueChangeEvent` handler.

  Specified by:
    `addValueChangeHandler` in interface `HasValueChangeHandlers<java.util.Date>`
  Parameters:
    `handler` - the handler
  Returns:
    the registration for the event

### getCursorPos

    public int getCursorPos()

  Gets the current cursor position in the date box.

  Returns:
    the cursor position

### getDatePicker

    public DatePicker getDatePicker()

  Gets the date picker.

  Returns:
    the date picker

### getFormat

    public DateBox.Format getFormat()

  Gets the format instance used to control formatting and parsing of this `DateBox`.

  Returns:
    the format

### getTabIndex

    public int getTabIndex()

  Gets the date box's position in the tab index.

  Returns:
    the date box's tab index

### getTextBox

    public TextBox getTextBox()

  Get text box.

  Returns:
    the text box used to enter the formatted date

### getValue

    public java.util.Date getValue()

  Get the date displayed, or null if the text box is empty, or cannot be interpreted.

  Specified by:
    `getValue` in interface `HasValue<java.util.Date>`
  Returns:
    the current date value

### hideDatePicker

    public void hideDatePicker()

  Hide the date picker.

### isDatePickerShowing

    public boolean isDatePickerShowing()

  Returns:
    true if date picker is currently showing, false if not

### setAccessKey

    public 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

### setEnabled

    public void setEnabled(boolean enabled)

  Sets whether the date box is enabled.

  Parameters:
    `enabled` - is the box enabled

### setFocus

    public 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

### setFormat

    public void setFormat(DateBox.Format format)

  Sets the format used to control formatting and parsing of dates in this `DateBox`. If this `DateBox` is not empty, the contents of date box will be replaced with current contents in the new format.

  Parameters:
    `format` - the new date format

### setTabIndex

    public 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 `-1` will cause this widget to be removed from the tab order.

  Parameters:
    `index` - the date box's tab index

### setValue

    public void setValue(java.util.Date date)

  Set the date.

  Specified by:
    `setValue` in interface `HasValue<java.util.Date>`
  Parameters:
    `date` - the object's new value

### setValue

    public void setValue(java.util.Date date,
                         boolean fireEvents)

  Description copied from interface: `HasValue`
  Sets this object's value. Fires `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.

  Specified by:
    `setValue` in interface `HasValue<java.util.Date>`
  Parameters:
    `date` - the object's new value
    `fireEvents` - fire events if true and value is new

### showDatePicker

    public void showDatePicker()

  Parses the current date box's value and shows that date.

Overview | Package | Class | Tree | Deprecated | Index | Help
| GWT 2.0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD