public class

CalendarModel

extends Object
java.lang.Object
   ↳ com.google.gwt.user.datepicker.client.CalendarModel

Class Overview

Model used to get calendar information for DatePicker and its subclasses.

Summary

Constants
int DAYS_IN_WEEK Number of days normally displayed in a week.
int WEEKS_IN_MONTH The number of weeks normally displayed in a month.
Public Constructors
CalendarModel()
Constructor.
Public Methods
String formatCurrentMonth()
Formats the current specified month.
String formatDayOfMonth(Date date)
Formats a date's day of month.
String formatDayOfWeek(int dayInWeek)
Format a day in the week.
Date getCurrentFirstDayOfFirstWeek()
Gets the first day of the first week in the currently specified month.
Date getCurrentMonth()
Gets the date representation of the currently specified month.
boolean isInCurrentMonth(Date date)
Is a date in the currently specified month?
void setCurrentMonth(Date currentDate)
Sets the currently specified date.
void shiftCurrentMonth(int deltaMonths)
Shifts the currently specified date by the given number of months.
Protected Methods
DateTimeFormat getDayOfMonthFormatter()
Gets the date of month formatter.
DateTimeFormat getDayOfWeekFormatter()
Gets the day of week formatter.
DateTimeFormat getMonthAndYearFormatter()
Gets the month and year formatter.
void refresh()
Refresh the current model as needed.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int DAYS_IN_WEEK

Number of days normally displayed in a week.

Constant Value: 7 (0x00000007)

public static final int WEEKS_IN_MONTH

The number of weeks normally displayed in a month.

Constant Value: 6 (0x00000006)

Public Constructors

public CalendarModel ()

Constructor.

Public Methods

public String formatCurrentMonth ()

Formats the current specified month. For example "Sep".

Returns
  • the formatted month

public String formatDayOfMonth (Date date)

Formats a date's day of month. For example "1".

Parameters
date the date
Returns
  • the formated day of month

public String formatDayOfWeek (int dayInWeek)

Format a day in the week. So, for example "Monday".

Parameters
dayInWeek the day in week to format
Returns
  • the formatted day in week

public Date getCurrentFirstDayOfFirstWeek ()

Gets the first day of the first week in the currently specified month.

Returns
  • the first day

public Date getCurrentMonth ()

Gets the date representation of the currently specified month. Used to access both the month and year information.

Returns
  • the month and year

public boolean isInCurrentMonth (Date date)

Is a date in the currently specified month?

Parameters
date the date
Returns
  • date

public void setCurrentMonth (Date currentDate)

Sets the currently specified date.

Parameters
currentDate the currently specified date

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

Protected Methods

protected DateTimeFormat getDayOfMonthFormatter ()

Gets the date of month formatter.

Returns
  • the day of month formatter

protected DateTimeFormat getDayOfWeekFormatter ()

Gets the day of week formatter.

Returns
  • the day of week formatter

protected DateTimeFormat getMonthAndYearFormatter ()

Gets the month and year formatter.

Returns
  • the month and year formatter

protected void refresh ()

Refresh the current model as needed.