Package com.google.gwt.cell.client
Class DatePickerCell
- java.lang.Object
-
- com.google.gwt.cell.client.AbstractCell<C>
-
- com.google.gwt.cell.client.AbstractEditableCell<java.util.Date,java.util.Date>
-
- com.google.gwt.cell.client.DatePickerCell
-
- All Implemented Interfaces:
Cell<java.util.Date>
public class DatePickerCell extends AbstractEditableCell<java.util.Date,java.util.Date>
ACell
used to render and editDate
s. When a cell is selected by clicking on it, aDatePicker
is popped up. When a date is selected using theDatePicker
, the new date is passed to theupdate
method of theValueUpdater
that was passed toonBrowserEvent(com.google.gwt.cell.client.Cell.Context, com.google.gwt.dom.client.Element, java.util.Date, com.google.gwt.dom.client.NativeEvent, com.google.gwt.cell.client.ValueUpdater<java.util.Date>)
for the click event. Note that this means that the call toValueUpdater.update(C)
will occur afteronBrowserEvent(com.google.gwt.cell.client.Cell.Context, com.google.gwt.dom.client.Element, java.util.Date, com.google.gwt.dom.client.NativeEvent, com.google.gwt.cell.client.ValueUpdater<java.util.Date>)
has returned. Pressing the 'escape' key dismisses theDatePicker
popup without callingValueUpdater.update(C)
.Each
DatePickerCell
has a uniqueDatePicker
popup associated with it; thus, if a singleDatePickerCell
is used as the cell for a column in a table, only one entry in that column will be editable at a given time.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.gwt.cell.client.Cell
Cell.Context
-
-
Constructor Summary
Constructors Constructor Description DatePickerCell()
Constructs a new DatePickerCell that uses the date/time format given byDateTimeFormat.getFullDateFormat()
.DatePickerCell(DateTimeFormat format)
Constructs a new DatePickerCell that uses the given date/time format and aSimpleSafeHtmlRenderer
.DatePickerCell(DateTimeFormat format, SafeHtmlRenderer<java.lang.String> renderer)
Constructs a new DatePickerCell that uses the given date/time format andSafeHtmlRenderer
.DatePickerCell(SafeHtmlRenderer<java.lang.String> renderer)
Constructs a new DatePickerCell that uses the date/time format given byDateTimeFormat.getFullDateFormat()
and the givenSafeHtmlRenderer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DatePicker
getDatePicker()
Returns the underlyingDatePicker
widget used by this cell.boolean
isEditing(Cell.Context context, Element parent, java.util.Date value)
Returns true if the cell is currently editing the data identified by the given element and key.void
onBrowserEvent(Cell.Context context, Element parent, java.util.Date value, NativeEvent event, ValueUpdater<java.util.Date> valueUpdater)
Handle a browser event that took place within the cell.protected void
onEnterKeyDown(Cell.Context context, Element parent, java.util.Date value, NativeEvent event, ValueUpdater<java.util.Date> valueUpdater)
Called when the user triggers akeydown
event with the ENTER key while focused on the cell.void
render(Cell.Context context, java.util.Date value, SafeHtmlBuilder sb)
Render a cell as HTML into aSafeHtmlBuilder
, suitable for passing toElement.setInnerHTML(String)
on a container element.-
Methods inherited from class com.google.gwt.cell.client.AbstractEditableCell
clearViewData, getViewData, setViewData
-
Methods inherited from class com.google.gwt.cell.client.AbstractCell
dependsOnSelection, getConsumedEvents, handlesSelection, resetFocus, setValue
-
-
-
-
Constructor Detail
-
DatePickerCell
public DatePickerCell()
Constructs a new DatePickerCell that uses the date/time format given byDateTimeFormat.getFullDateFormat()
.
-
DatePickerCell
public DatePickerCell(DateTimeFormat format)
Constructs a new DatePickerCell that uses the given date/time format and aSimpleSafeHtmlRenderer
.- Parameters:
format
- aDateTimeFormat
instance
-
DatePickerCell
public DatePickerCell(SafeHtmlRenderer<java.lang.String> renderer)
Constructs a new DatePickerCell that uses the date/time format given byDateTimeFormat.getFullDateFormat()
and the givenSafeHtmlRenderer
.- Parameters:
renderer
- aSafeHtmlRenderer
instance
-
DatePickerCell
public DatePickerCell(DateTimeFormat format, SafeHtmlRenderer<java.lang.String> renderer)
Constructs a new DatePickerCell that uses the given date/time format andSafeHtmlRenderer
.- Parameters:
format
- aDateTimeFormat
instancerenderer
- aSafeHtmlRenderer
instance
-
-
Method Detail
-
getDatePicker
public DatePicker getDatePicker()
Returns the underlyingDatePicker
widget used by this cell.
-
isEditing
public boolean isEditing(Cell.Context context, Element parent, java.util.Date value)
Description copied from class:AbstractEditableCell
Returns true if the cell is currently editing the data identified by the given element and key. While a cell is editing, widgets containing the cell may choose to pass keystrokes directly to the cell rather than using them for navigation purposes.- Specified by:
isEditing
in interfaceCell<java.util.Date>
- Specified by:
isEditing
in classAbstractEditableCell<java.util.Date,java.util.Date>
- Parameters:
context
- theCell.Context
of the cellparent
- the parent Elementvalue
- the value associated with the cell- Returns:
- true if the cell is in edit mode
-
onBrowserEvent
public void onBrowserEvent(Cell.Context context, Element parent, java.util.Date value, NativeEvent event, ValueUpdater<java.util.Date> valueUpdater)
Description copied from class:AbstractCell
Handle a browser event that took place within the cell. The default implementation returns null.If you override this method to add support for events, remember to pass the event types that the cell expects into the constructor.
- Specified by:
onBrowserEvent
in interfaceCell<java.util.Date>
- Overrides:
onBrowserEvent
in classAbstractCell<java.util.Date>
- Parameters:
context
- theCell.Context
of the cellparent
- the parent Elementvalue
- the value associated with the cellevent
- the native browser eventvalueUpdater
- aValueUpdater
, or null if not specified
-
render
public void render(Cell.Context context, java.util.Date value, SafeHtmlBuilder sb)
Description copied from interface:Cell
Render a cell as HTML into aSafeHtmlBuilder
, suitable for passing toElement.setInnerHTML(String)
on a container element.Note: If your cell contains natively focusable elements, such as buttons or input elements, be sure to set the tabIndex to -1 so that they do not steal focus away from the containing widget.
- Specified by:
render
in interfaceCell<java.util.Date>
- Specified by:
render
in classAbstractCell<java.util.Date>
- Parameters:
context
- theCell.Context
of the cellvalue
- the cell value to be renderedsb
- theSafeHtmlBuilder
to be written to
-
onEnterKeyDown
protected void onEnterKeyDown(Cell.Context context, Element parent, java.util.Date value, NativeEvent event, ValueUpdater<java.util.Date> valueUpdater)
Description copied from class:AbstractCell
Called when the user triggers akeydown
event with the ENTER key while focused on the cell. If your cell interacts with the user, you should override this method to provide a consistent user experience. Your widget must consumekeydown
events for this method to be called.- Overrides:
onEnterKeyDown
in classAbstractCell<java.util.Date>
- Parameters:
context
- theCell.Context
of the cellparent
- the parent Elementvalue
- the value associated with the cellevent
- the native browser eventvalueUpdater
- aValueUpdater
, or null if not specified
-
-