|
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.DatePicker
public class DatePicker
Standard GWT date picker.
public class DatePickerExample implements EntryPoint { public void onModuleLoad() { // Create a date picker DatePicker datePicker = new DatePicker(); final Label text = new Label(); // Set the value in the text box when the user selects a date datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() { public void onValueChange(ValueChangeEvent<Date> event) { Date date = event.getValue(); String dateString = DateTimeFormat.getMediumDateFormat().format(date); text.setText(dateString); } }); // Set the default value datePicker.setValue(new Date(), true); // Add the widgets to the page RootPanel.get().add(text); RootPanel.get().add(datePicker); } }
Nested Class Summary | |
---|---|
(package private) static class |
DatePicker.StandardCss
Convenience class to group css style names. |
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
Field Summary |
---|
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
Constructor Summary | |
---|---|
|
DatePicker()
Create a new date picker. |
protected |
DatePicker(MonthSelector monthAndYearSelector,
CalendarView view,
CalendarModel model)
Creates a new date picker. |
Method Summary | |
---|---|
HandlerRegistration |
addHighlightHandler(HighlightHandler<java.util.Date> handler)
Adds a HighlightEvent handler. |
HandlerRegistration |
addShowRangeHandler(ShowRangeHandler<java.util.Date> handler)
Adds a ShowRangeEvent handler. |
HandlerRegistration |
addShowRangeHandlerAndFire(ShowRangeHandler<java.util.Date> handler)
Adds a show range handler and immediately activate the handler on the current view. |
void |
addStyleToDates(java.lang.String styleName,
java.util.Date date)
Add a style name to the given dates. |
void |
addStyleToDates(java.lang.String styleName,
java.util.Date date,
java.util.Date... moreDates)
Add a style name to the given dates. |
void |
addStyleToDates(java.lang.String styleName,
java.lang.Iterable<java.util.Date> dates)
Add a style name to the given dates. |
void |
addTransientStyleToDates(java.lang.String styleName,
java.util.Date date)
Adds the given style name to the specified dates, which must be visible. |
void |
addTransientStyleToDates(java.lang.String styleName,
java.util.Date date,
java.util.Date... moreDates)
Adds the given style name to the specified dates, which must be visible. |
void |
addTransientStyleToDates(java.lang.String styleName,
java.lang.Iterable<java.util.Date> dates)
Adds the given style name to the specified dates, which must be visible. |
HandlerRegistration |
addValueChangeHandler(ValueChangeHandler<java.util.Date> handler)
Adds a ValueChangeEvent handler. |
LeafValueEditor<java.util.Date> |
asEditor()
Returns a TakesValueEditor backed by the DatePicker. |
(package private) DatePicker.StandardCss |
css()
Gets the css associated with this date picker for use by extended month and cell grids. |
java.util.Date |
getCurrentMonth()
Gets the current month the date picker is showing. |
java.util.Date |
getFirstDate()
Returns the first shown date. |
java.util.Date |
getHighlightedDate()
Gets the highlighted date (the one the mouse is hovering over), if any. |
java.util.Date |
getLastDate()
Returns the last shown date. |
protected CalendarModel |
getModel()
Gets the CalendarModel associated with this date picker. |
protected MonthSelector |
getMonthSelector()
Gets the MonthSelector associated with this date picker. |
java.lang.String |
getStyleOfDate(java.util.Date date)
Gets the style associated with a date (does not include styles set via addTransientStyleToDates(java.lang.String, java.util.Date) ). |
java.util.Date |
getValue()
Returns the selected date, or null if none is selected. |
protected CalendarView |
getView()
Gets the CalendarView associated with this date picker. |
int |
getVisibleYearCount()
Returns the number of year to display in the years selection dropdown. |
boolean |
isDateEnabled(java.util.Date date)
Is the visible date enabled? |
boolean |
isDateVisible(java.util.Date date)
Is the date currently shown in the date picker? |
boolean |
isYearAndMonthDropdownVisible()
Is the year and month selectable via a dropdown? |
boolean |
isYearArrowsVisible()
Can the user navigate through the years? |
void |
onLoad()
This method is called immediately after a widget becomes attached to the browser's document. |
protected void |
refreshAll()
Refreshes all components of this date picker. |
void |
removeStyleFromDates(java.lang.String styleName,
java.util.Date date)
Removes the styleName from the given dates (even if it is transient). |
void |
removeStyleFromDates(java.lang.String styleName,
java.util.Date date,
java.util.Date... moreDates)
Removes the styleName from the given dates (even if it is transient). |
void |
removeStyleFromDates(java.lang.String styleName,
java.lang.Iterable<java.util.Date> dates)
Removes the styleName from the given dates (even if it is transient). |
void |
setCurrentMonth(java.util.Date month)
Sets the date picker to show the given month, use getFirstDate()
and getLastDate() to access the exact date range the date picker
chose to display. |
(package private) void |
setHighlightedDate(java.util.Date highlighted)
Sets the highlighted date. |
void |
setStyleName(java.lang.String styleName)
Sets the date picker style name. |
void |
setTransientEnabledOnDates(boolean enabled,
java.util.Date date)
Sets a visible date to be enabled or disabled. |
void |
setTransientEnabledOnDates(boolean enabled,
java.util.Date date,
java.util.Date... moreDates)
Sets a visible date to be enabled or disabled. |
void |
setTransientEnabledOnDates(boolean enabled,
java.lang.Iterable<java.util.Date> dates)
Sets a group of visible dates to be enabled or disabled. |
protected void |
setup()
Sets up the date picker. |
void |
setValue(java.util.Date newValue)
Sets the DatePicker 's value. |
void |
setValue(java.util.Date newValue,
boolean fireEvents)
Sets the DatePicker 's value. |
void |
setVisibleYearCount(int numberOfYears)
Set the number of years to display in the years selection dropdown. |
void |
setYearAndMonthDropdownVisible(boolean dropdownVisible)
If the dropdownVisible is equal to true, the user will be able to change the current month and
the current year of the date picker via two dropdown lists. |
void |
setYearArrowsVisible(boolean yearArrowsVisible)
Set if the user can navigate through the years via a set of backward and forward buttons. |
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, 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, 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 |
Constructor Detail |
---|
public DatePicker()
protected DatePicker(MonthSelector monthAndYearSelector, CalendarView view, CalendarModel model)
monthAndYearSelector
- the month selectorview
- the viewmodel
- the modelMethod Detail |
---|
public HandlerRegistration addHighlightHandler(HighlightHandler<java.util.Date> handler)
HasHighlightHandlers
HighlightEvent
handler.
addHighlightHandler
in interface HasHighlightHandlers<java.util.Date>
handler
- the handler
public HandlerRegistration addShowRangeHandler(ShowRangeHandler<java.util.Date> handler)
HasShowRangeHandlers
ShowRangeEvent
handler.
addShowRangeHandler
in interface HasShowRangeHandlers<java.util.Date>
handler
- the handler
public HandlerRegistration addShowRangeHandlerAndFire(ShowRangeHandler<java.util.Date> handler)
handler
- the handler
public void addStyleToDates(java.lang.String styleName, java.util.Date date)
public void addStyleToDates(java.lang.String styleName, java.util.Date date, java.util.Date... moreDates)
public void addStyleToDates(java.lang.String styleName, java.lang.Iterable<java.util.Date> dates)
public void addTransientStyleToDates(java.lang.String styleName, java.util.Date date)
public final void addTransientStyleToDates(java.lang.String styleName, java.util.Date date, java.util.Date... moreDates)
public final void addTransientStyleToDates(java.lang.String styleName, java.lang.Iterable<java.util.Date> dates)
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 DatePicker.
asEditor
in interface IsEditor<LeafValueEditor<java.util.Date>>
Editor
of type Epublic java.util.Date getCurrentMonth()
A datepicker may show days not in the current month. It must show all days in the current month.
public final java.util.Date getFirstDate()
public final java.util.Date getHighlightedDate()
public final java.util.Date getLastDate()
public int getVisibleYearCount()
public java.lang.String getStyleOfDate(java.util.Date date)
addTransientStyleToDates(java.lang.String, java.util.Date)
).
date
- the date
public final java.util.Date getValue()
getValue
in interface TakesValue<java.util.Date>
getValue
in interface HasValue<java.util.Date>
TakesValue.setValue(V)
public boolean isDateEnabled(java.util.Date date)
date
- the date, which must be visible
public boolean isDateVisible(java.util.Date date)
date
-
public boolean isYearArrowsVisible()
public boolean isYearAndMonthDropdownVisible()
public void onLoad()
Widget
onLoad
in class Widget
public void removeStyleFromDates(java.lang.String styleName, java.util.Date date)
public void removeStyleFromDates(java.lang.String styleName, java.util.Date date, java.util.Date... moreDates)
public void removeStyleFromDates(java.lang.String styleName, java.lang.Iterable<java.util.Date> dates)
public void setCurrentMonth(java.util.Date month)
getFirstDate()
and getLastDate()
to access the exact date range the date picker
chose to display.
A datepicker may show days not in the current month. It must show all days in the current month.
month
- the month to showpublic void setVisibleYearCount(int numberOfYears)
public void setYearArrowsVisible(boolean yearArrowsVisible)
public void setYearAndMonthDropdownVisible(boolean dropdownVisible)
dropdownVisible
is equal to true, the user will be able to change the current month and
the current year of the date picker via two dropdown lists.
public void setStyleName(java.lang.String styleName)
setStyleName
in class UIObject
styleName
- the new style nameUIObject.setStylePrimaryName(String)
public final void setTransientEnabledOnDates(boolean enabled, java.util.Date date)
public final void setTransientEnabledOnDates(boolean enabled, java.util.Date date, java.util.Date... moreDates)
public final void setTransientEnabledOnDates(boolean enabled, java.lang.Iterable<java.util.Date> dates)
public final void setValue(java.util.Date newValue)
DatePicker
's value.
setValue
in interface TakesValue<java.util.Date>
setValue
in interface HasValue<java.util.Date>
newValue
- the new valueTakesValue.getValue()
public final void setValue(java.util.Date newValue, boolean fireEvents)
DatePicker
's value.
setValue
in interface HasValue<java.util.Date>
newValue
- the new value for this date pickerfireEvents
- should events be fired.protected final CalendarModel getModel()
CalendarModel
associated with this date picker.
protected final MonthSelector getMonthSelector()
MonthSelector
associated with this date picker.
protected final CalendarView getView()
CalendarView
associated with this date picker.
protected final void refreshAll()
protected void setup()
final DatePicker.StandardCss css()
void setHighlightedDate(java.util.Date highlighted)
highlighted
- highlighted date
|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |