Class CalendarModel
java.lang.Object
com.google.gwt.user.datepicker.client.CalendarModel
Model used to get calendar information for
DatePicker
and its
subclasses.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Number of days normally displayed in a week.static final int
static final int
The number of weeks normally displayed in a month. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionFormats the current specified month.Format the current month and year in the current locale.Formats the current specified year.formatDayOfMonth
(Date date) Formats a date's day of month.formatDayOfWeek
(int dayInWeek) Format a day in the week.formatMonth
(int month) Format a month in the year.Gets the first day of the first week in the currently specified month.Gets the date representation of the currently specified month.protected DateTimeFormat
Gets the date of month formatter.protected DateTimeFormat
Gets the day of week formatter.protected DateTimeFormat
Gets the month and year formatter.protected DateTimeFormat
Gets the month formatter.protected DateTimeFormat
Gets the year formatter.boolean
isInCurrentMonth
(Date date) Is a date in the currently specified month?protected boolean
Returnstrue
if the month is before year in the date formatter in current locale.protected void
refresh()
Refresh the current model as needed.void
setCurrentMonth
(Date currentDate) Sets the currently specified date.void
shiftCurrentMonth
(int deltaMonths) Shifts the currently specified date by the given number of months.
-
Field Details
-
WEEKS_IN_MONTH
public static final int WEEKS_IN_MONTHThe number of weeks normally displayed in a month.- See Also:
-
DAYS_IN_WEEK
public static final int DAYS_IN_WEEKNumber of days normally displayed in a week.- See Also:
-
MONTHS_IN_YEAR
public static final int MONTHS_IN_YEAR- See Also:
-
-
Constructor Details
-
CalendarModel
public CalendarModel()Constructor.
-
-
Method Details
-
formatCurrentMonth
Formats the current specified month. For example "September" in English.- Returns:
- the formatted month
-
formatCurrentMonthAndYear
Format the current month and year in the current locale. For example, "Jan 2013" in English.- Returns:
- the formatted month and year
-
formatCurrentYear
Formats the current specified year. For example "2012".- Returns:
- the formatted year
-
formatDayOfMonth
Formats a date's day of month. For example "1".- Parameters:
date
- the date- Returns:
- the formated day of month
-
formatDayOfWeek
Format a day in the week. So, for example "Monday".- Parameters:
dayInWeek
- the day in week to format- Returns:
- the formatted day in week
-
formatMonth
Format a month in the year. So, for example "January".- Parameters:
month
- A number from 0 (for January) to 11 (for December) identifying the month wanted.- Returns:
- the formatted month
-
getCurrentFirstDayOfFirstWeek
Gets the first day of the first week in the currently specified month.- Returns:
- the first day
-
getCurrentMonth
Gets the date representation of the currently specified month. Used to access both the month and year information.- Returns:
- the month and year
-
isInCurrentMonth
Is a date in the currently specified month?- Parameters:
date
- the date- Returns:
- date
-
setCurrentMonth
Sets the currently specified date.- Parameters:
currentDate
- the currently specified date
-
shiftCurrentMonth
public void shiftCurrentMonth(int deltaMonths) Shifts the currently specified date by the given number of months. The day of the month will be pinned to the original value as far as possible.- Parameters:
deltaMonths
- - number of months to be added to the current date
-
getDayOfMonthFormatter
Gets the date of month formatter.- Returns:
- the day of month formatter
-
getDayOfWeekFormatter
Gets the day of week formatter.- Returns:
- the day of week formatter
-
getMonthAndYearFormatter
Gets the month and year formatter.- Returns:
- the month and year formatter
-
getMonthFormatter
Gets the month formatter.- Returns:
- the month formatter
-
getYearFormatter
Gets the year formatter.- Returns:
- the year formatter
-
isMonthBeforeYear
protected boolean isMonthBeforeYear()Returnstrue
if the month is before year in the date formatter in current locale. -
refresh
protected void refresh()Refresh the current model as needed.
-