com.google.gwt.widgetideas.datepicker.client
Class DatePicker

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.google.gwt.widgetideas.datepicker.client.DatePicker
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, FiresChangeEvents<java.util.Date>, FiresHighlightEvents<java.util.Date>, FiresRenderingEvents

public class DatePicker
extends com.google.gwt.user.client.ui.Composite
implements FiresChangeEvents<java.util.Date>, FiresHighlightEvents<java.util.Date>, FiresRenderingEvents

Date picker.


Nested Class Summary
protected static class DatePicker.Styles
          Styles used for the DatePicker family of widgets.
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
  DatePicker()
          Constructor.
protected DatePicker(MonthSelector monthSelector, CalendarView calendarView, CalendarModel model)
          Constructor for use by subtypes.
 
Method Summary
 void addChangeHandler(ChangeHandler<java.util.Date> handler)
          Adds a change handler.
 void addGlobalDateStyle(java.util.Date date, java.lang.String styleName)
          Globally adds a style name to a date.
 void addHighlightHandler(HighlightHandler<java.util.Date> handler)
          Adds a highlight handler.
 void addRenderingHandler(RenderingHandler handler)
          Adds a rendering handler.
 void addVisibleDateStyle(java.util.Date date, java.lang.String styleName)
          Shows the given style name on the specified date.
 void addVisibleDateStyles(java.lang.Iterable<java.util.Date> dates, java.lang.String styleName)
          Removes a style name from multiple dates.
protected  CalendarView getCalendarView()
          Gets the date view currently associated with this date picker.
 java.util.Date getDateShown()
          Gets the currently shown date.
 java.lang.String getGlobalDateStyle(java.util.Date d)
          Gets the global style name associated with a date.
 java.util.Date getHighlightedDate()
          Gets the highlighted date, if any.
protected  CalendarModel getModel()
          Gets the model associated with this date picker.
protected  com.google.gwt.user.client.ui.Widget getMonthSelector()
          Gets the month selector associated with this date picker.
 java.util.Date getSelectedDate()
          Gets the selected date, if any.
 boolean isDateEnabled(java.util.Date date)
          Is the date enabled?
 boolean isDateVisible(java.util.Date date)
          Is the date currently shown in the date picker?
 void removeChangeHandler(ChangeHandler<java.util.Date> handler)
          Removes a change handler.
 void removeGlobalDateStyle(java.util.Date date, java.lang.String styleName)
          Globally removes a style from a date.
 void removeHighlightHandler(HighlightHandler<java.util.Date> handler)
          Removes a highlight handler.
 void removeRenderingHandler(RenderingHandler handler)
          Removes a rendering handler.
 void removeVisibleDateStyles(java.util.Iterator<java.util.Date> dates, java.lang.String styleName)
          Removes a style name from multiple visible dates.
 void selectHighlightedDate()
          Selects the current highlighted date.
 void setAllowableDates(java.util.Date from, java.util.Date to)
          Restricts the date range this picker can show.
 void setSelectedDate(java.util.Date date)
          Sets the selected date.
protected  void setup()
          Sets up the date picker.
 void setVisibleDateEnabled(java.util.Date date, boolean enabled)
          Sets a visible date to be enabled or disabled.
 void setVisibleEnabledDates(java.lang.Iterable<java.util.Date> dates, boolean enabled)
          Sets a group of visible dates to be enabled or disabled.
 void showDate(java.util.Date date)
          This method causes the DatePicker to show the given date.
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getElement, getWidget, initWidget, isAttached, onAttach, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, onBrowserEvent, onLoad, onUnload, removeFromParent, setElement
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DatePicker

public DatePicker()
Constructor.


DatePicker

protected DatePicker(MonthSelector monthSelector,
                     CalendarView calendarView,
                     CalendarModel model)
Constructor for use by subtypes.

Parameters:
monthSelector - the month selector
calendarView - the calendar view
model - the calendar model
Method Detail

addChangeHandler

public final void addChangeHandler(ChangeHandler<java.util.Date> handler)
Description copied from interface: FiresChangeEvents
Adds a change handler.

Specified by:
addChangeHandler in interface FiresChangeEvents<java.util.Date>
Parameters:
handler - the handler

addGlobalDateStyle

public void addGlobalDateStyle(java.util.Date date,
                               java.lang.String styleName)
Globally adds a style name to a date. i.e. the style name is associated with the date each time it is rendered.

Parameters:
date - date
styleName - style name

addHighlightHandler

public final void addHighlightHandler(HighlightHandler<java.util.Date> handler)
Description copied from interface: FiresHighlightEvents
Adds a highlight handler.

Specified by:
addHighlightHandler in interface FiresHighlightEvents<java.util.Date>
Parameters:
handler - the handler

addRenderingHandler

public final void addRenderingHandler(RenderingHandler handler)
Description copied from interface: FiresRenderingEvents
Adds a rendering handler.

Specified by:
addRenderingHandler in interface FiresRenderingEvents
Parameters:
handler - the handler

addVisibleDateStyle

public final void addVisibleDateStyle(java.util.Date date,
                                      java.lang.String styleName)
Shows the given style name on the specified date. This is only set until the next time the DatePicker is refreshed.

Parameters:
date - date
styleName - style name

addVisibleDateStyles

public final void addVisibleDateStyles(java.lang.Iterable<java.util.Date> dates,
                                       java.lang.String styleName)
Removes a style name from multiple dates.

Parameters:
dates - dates that will have the supplied style removed
styleName - style name to remove

getDateShown

public java.util.Date getDateShown()
Gets the currently shown date.


getGlobalDateStyle

public java.lang.String getGlobalDateStyle(java.util.Date d)
Gets the global style name associated with a date.


getHighlightedDate

public final java.util.Date getHighlightedDate()
Gets the highlighted date, if any.


getSelectedDate

public final java.util.Date getSelectedDate()
Gets the selected date, if any.


isDateEnabled

public boolean isDateEnabled(java.util.Date date)
Is the date enabled?

Parameters:
date -
Returns:
is the date enabled?

isDateVisible

public boolean isDateVisible(java.util.Date date)
Is the date currently shown in the date picker?

Parameters:
date -
Returns:
is the date currently shown

removeChangeHandler

public final void removeChangeHandler(ChangeHandler<java.util.Date> handler)
Description copied from interface: FiresChangeEvents
Removes a change handler.

Specified by:
removeChangeHandler in interface FiresChangeEvents<java.util.Date>
Parameters:
handler - the handler

removeGlobalDateStyle

public void removeGlobalDateStyle(java.util.Date date,
                                  java.lang.String styleName)
Globally removes a style from a date.

Parameters:
date - date
styleName - style name

removeHighlightHandler

public final void removeHighlightHandler(HighlightHandler<java.util.Date> handler)
Description copied from interface: FiresHighlightEvents
Removes a highlight handler.

Specified by:
removeHighlightHandler in interface FiresHighlightEvents<java.util.Date>
Parameters:
handler - the handler

removeRenderingHandler

public final void removeRenderingHandler(RenderingHandler handler)
Description copied from interface: FiresRenderingEvents
Removes a rendering handler.

Specified by:
removeRenderingHandler in interface FiresRenderingEvents
Parameters:
handler - the handler

removeVisibleDateStyles

public final void removeVisibleDateStyles(java.util.Iterator<java.util.Date> dates,
                                          java.lang.String styleName)
Removes a style name from multiple visible dates.

Parameters:
dates - dates that will have the supplied style removed
styleName - style name to remove

selectHighlightedDate

public final void selectHighlightedDate()
Selects the current highlighted date.


setAllowableDates

public final void setAllowableDates(java.util.Date from,
                                    java.util.Date to)
Restricts the date range this picker can show.

(Note: not yet implemented for default case).


setSelectedDate

public final void setSelectedDate(java.util.Date date)
Sets the selected date.


setVisibleDateEnabled

public final void setVisibleDateEnabled(java.util.Date date,
                                        boolean enabled)
Sets a visible date to be enabled or disabled. This is only set until the next time the DatePicker is refreshed.

Parameters:
date - the date
enabled - is enabled

setVisibleEnabledDates

public final void setVisibleEnabledDates(java.lang.Iterable<java.util.Date> dates,
                                         boolean enabled)
Sets a group of visible dates to be enabled or disabled. This is only set until the next time the DatePicker is refreshed.

Parameters:
dates - the dates
enabled - is enabled

showDate

public final void showDate(java.util.Date date)
This method causes the DatePicker to show the given date.


getCalendarView

protected final CalendarView getCalendarView()
Gets the date view currently associated with this date picker.

Returns:
calendar view

getModel

protected final CalendarModel getModel()
Gets the model associated with this date picker.

Returns:
the model

getMonthSelector

protected final com.google.gwt.user.client.ui.Widget getMonthSelector()
Gets the month selector associated with this date picker.

Returns:
the month selector

setup

protected void setup()
Sets up the date picker.