public class DatePicker extends Composite implements HasHighlightHandlers<Date>, HasShowRangeHandlers<Date>, HasValue<Date>, IsEditor<LeafValueEditor<Date>>
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
DEBUG_ID_PREFIX
Modifier | Constructor and Description |
---|---|
|
DatePicker()
Create a new date picker.
|
protected |
DatePicker(MonthSelector monthAndYearSelector,
CalendarView view,
CalendarModel model)
Creates a new date picker.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addHighlightHandler(HighlightHandler<Date> handler)
Adds a
HighlightEvent handler. |
HandlerRegistration |
addShowRangeHandler(ShowRangeHandler<Date> handler)
Adds a
ShowRangeEvent handler. |
HandlerRegistration |
addShowRangeHandlerAndFire(ShowRangeHandler<Date> handler)
Adds a show range handler and immediately activate the handler on the
current view.
|
void |
addStyleToDates(String styleName,
Date date)
Add a style name to the given dates.
|
void |
addStyleToDates(String styleName,
Date date,
Date... moreDates)
Add a style name to the given dates.
|
void |
addStyleToDates(String styleName,
Iterable<Date> dates)
Add a style name to the given dates.
|
void |
addTransientStyleToDates(String styleName,
Date date)
Adds the given style name to the specified dates, which must be visible.
|
void |
addTransientStyleToDates(String styleName,
Date date,
Date... moreDates)
Adds the given style name to the specified dates, which must be visible.
|
void |
addTransientStyleToDates(String styleName,
Iterable<Date> dates)
Adds the given style name to the specified dates, which must be visible.
|
HandlerRegistration |
addValueChangeHandler(ValueChangeHandler<Date> handler)
Adds a
ValueChangeEvent handler. |
LeafValueEditor<Date> |
asEditor()
Returns a
TakesValueEditor backed by the DatePicker. |
Date |
getCurrentMonth()
Gets the current month the date picker is showing.
|
Date |
getFirstDate()
Returns the first shown date.
|
Date |
getHighlightedDate()
Gets the highlighted date (the one the mouse is hovering over), if any.
|
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. |
String |
getStyleOfDate(Date date)
Gets the style associated with a date (does not include styles set via
addTransientStyleToDates(java.lang.String, java.util.Date) ). |
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(Date date)
Is the visible date enabled?
|
boolean |
isDateVisible(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(String styleName,
Date date)
Removes the styleName from the given dates (even if it is transient).
|
void |
removeStyleFromDates(String styleName,
Date date,
Date... moreDates)
Removes the styleName from the given dates (even if it is transient).
|
void |
removeStyleFromDates(String styleName,
Iterable<Date> dates)
Removes the styleName from the given dates (even if it is transient).
|
void |
setCurrentMonth(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. |
void |
setStyleName(String styleName)
Sets the date picker style name.
|
void |
setTransientEnabledOnDates(boolean enabled,
Date date)
Sets a visible date to be enabled or disabled.
|
void |
setTransientEnabledOnDates(boolean enabled,
Date date,
Date... moreDates)
Sets a visible date to be enabled or disabled.
|
void |
setTransientEnabledOnDates(boolean enabled,
Iterable<Date> dates)
Sets a group of visible dates to be enabled or disabled.
|
protected void |
setup()
Sets up the date picker.
|
void |
setValue(Date newValue)
Sets the
DatePicker 's value. |
void |
setValue(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.
|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
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
fireEvent
public DatePicker()
protected DatePicker(MonthSelector monthAndYearSelector, CalendarView view, CalendarModel model)
monthAndYearSelector
- the month selectorview
- the viewmodel
- the modelpublic HandlerRegistration addHighlightHandler(HighlightHandler<Date> handler)
HasHighlightHandlers
HighlightEvent
handler.addHighlightHandler
in interface HasHighlightHandlers<Date>
handler
- the handlerpublic HandlerRegistration addShowRangeHandler(ShowRangeHandler<Date> handler)
HasShowRangeHandlers
ShowRangeEvent
handler.addShowRangeHandler
in interface HasShowRangeHandlers<Date>
handler
- the handlerpublic HandlerRegistration addShowRangeHandlerAndFire(ShowRangeHandler<Date> handler)
handler
- the handlerpublic void addStyleToDates(String styleName, Date date)
public void addStyleToDates(String styleName, Date date, Date... moreDates)
public void addStyleToDates(String styleName, Iterable<Date> dates)
public void addTransientStyleToDates(String styleName, Date date)
public final void addTransientStyleToDates(String styleName, Date date, Date... moreDates)
public final void addTransientStyleToDates(String styleName, Iterable<Date> dates)
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Date> handler)
HasValueChangeHandlers
ValueChangeEvent
handler.addValueChangeHandler
in interface HasValueChangeHandlers<Date>
handler
- the handlerpublic LeafValueEditor<Date> asEditor()
TakesValueEditor
backed by the DatePicker.asEditor
in interface IsEditor<LeafValueEditor<Date>>
Editor
of type Epublic Date getCurrentMonth()
A datepicker may show days not in the current month. It must show all days in the current month.
public final Date getFirstDate()
public final Date getHighlightedDate()
public final Date getLastDate()
public int getVisibleYearCount()
public String getStyleOfDate(Date date)
addTransientStyleToDates(java.lang.String, java.util.Date)
).date
- the datepublic final Date getValue()
getValue
in interface TakesValue<Date>
getValue
in interface HasValue<Date>
TakesValue.setValue(V)
public boolean isDateEnabled(Date date)
date
- the date, which must be visiblepublic boolean isDateVisible(Date date)
date
- public boolean isYearArrowsVisible()
public boolean isYearAndMonthDropdownVisible()
public void onLoad()
Widget
public void removeStyleFromDates(String styleName, Date date)
public void removeStyleFromDates(String styleName, Date date, Date... moreDates)
public void removeStyleFromDates(String styleName, Iterable<Date> dates)
public void setCurrentMonth(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(String styleName)
setStyleName
in class UIObject
styleName
- the new style nameUIObject.setStylePrimaryName(String)
public final void setTransientEnabledOnDates(boolean enabled, Date date)
public final void setTransientEnabledOnDates(boolean enabled, Date date, Date... moreDates)
public final void setTransientEnabledOnDates(boolean enabled, Iterable<Date> dates)
public final void setValue(Date newValue)
DatePicker
's value.setValue
in interface TakesValue<Date>
setValue
in interface HasValue<Date>
newValue
- the new valueTakesValue.getValue()
public final void setValue(Date newValue, boolean fireEvents)
DatePicker
's value.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()
Copyright © 2018. All rights reserved.