Author: [EMAIL PROTECTED] Date: Fri Nov 21 08:54:23 2008 New Revision: 4153
Modified: branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DateBox.java branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DatePicker.java branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DefaultCalendarView.java Log: Making date picker expose setCurrentMonth/getCurrentMonth methods rather then showDate Modified: branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DateBox.java ============================================================================== --- branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DateBox.java (original) +++ branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DateBox.java Fri Nov 21 08:54:23 2008 @@ -301,7 +301,7 @@ if (current == null) { current = new Date(); } - picker.showDate(current); + picker.setCurrentMonth(current); popup.showRelativeTo(this); } @@ -312,7 +312,7 @@ */ public void showDate(Date date) { picker.setValue(date, false); - picker.showDate(date); + picker.setCurrentMonth(date); setText(date); dirtyText = false; } Modified: branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DatePicker.java ============================================================================== --- branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DatePicker.java (original) +++ branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DatePicker.java Fri Nov 21 08:54:23 2008 @@ -221,7 +221,7 @@ monthSelector.setup(); this.setup(); - showDate(new Date()); + setCurrentMonth(new Date()); addGlobalStyleToDate(new Date(), css().dayIsToday()); } @@ -292,6 +292,19 @@ } /** + * Gets the current month the date picker is showing. + * + * <p> + * A datepicker <b> may </b> show days not in the current month. It + * <b>must</b> show all days in the current month. + * </p> + * + */ + public Date getCurrentMonth(){ + return getModel().getCurrentMonth(); + } + + /** * Returns the first shown date. * * @return the first date. @@ -387,6 +400,20 @@ getView().removeStyleFromDate(date, styleName); } } + /** + * Sets the date picker to show the given month, use [EMAIL PROTECTED] #getFirstDate()} + * and [EMAIL PROTECTED] #getLastDate()} to access the exact date range the date picker + * chose to display. + * <p> + * A datepicker <b> may </b> show days not in the current month. It + * <b>must</b> show all days in the current month. + * </p> + * @param month the month to show + */ + public void setCurrentMonth(Date month) { + getModel().setCurrentMonth(month); + refreshAll(); + } /** * Sets a visible date to be enabled or disabled. This is only set until the @@ -449,18 +476,6 @@ addGlobalStyleToDate(value, css().dayIsValue()); } ValueChangeEvent.fire(this, newValue); - } - - /** - * Shows the given date, use [EMAIL PROTECTED] #getFirstDate()} and - * [EMAIL PROTECTED] #getLastDate()} to access the exact date range the date picker chose - * to display. - * - * @param date the date to show - */ - public void showDate(Date date) { - getModel().setCurrentMonth(date); - refreshAll(); } /** Modified: branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DefaultCalendarView.java ============================================================================== --- branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DefaultCalendarView.java (original) +++ branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DefaultCalendarView.java Fri Nov 21 08:54:23 2008 @@ -73,7 +73,7 @@ if (selected) { getDatePicker().setValue(getValue()); if (isFiller()) { - getDatePicker().showDate(getValue()); + getDatePicker().setCurrentMonth(getValue()); } } updateStyle(); --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---