com.google.gwt.widgetideas.datepicker.client.impl
Class LocaleCalendarUtils

java.lang.Object
  extended by java.util.Date
      extended by com.google.gwt.widgetideas.datepicker.client.impl.DatePickerDate
          extended by com.google.gwt.widgetideas.datepicker.client.impl.LocaleCalendarUtils
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.Date>

public class LocaleCalendarUtils
extends DatePickerDate

LocaleCalendarUtils public class provides all the tables required to display the calendar grid for a month with respect to a locale. It also provides methods to obtain following data:

Following calendar manipulation methods: Following methods for styling specific dates:

See Also:
Serialized Form

Field Summary
static int SELECTED
          Constant SELECTED represents the user selected date in the grid.
static int TODAY
          Constant TODAY represents today's date in the grid.
static int TYPE_CONTROL
          Constant TYPE_CONTROL represents the grid cell representing a control.
static int TYPE_CURR_MONTH
          Constant TYPE_CURR_MONTH represents the grid cells for currently displayed month.
static int TYPE_NEXT_MONTH
          Constant TYPE_NEXT_MONTH represents the grid cells for the month next to currently displayed one.
static int TYPE_PREV_MONTH
          Constant TYPE_PREV_MONTH represents the grid cells for the month previous to currently displayed one.
 
Constructor Summary
LocaleCalendarUtils(boolean adjacentMonths)
          Public constructor for LocaleCalendarUtils class.
 
Method Summary
 boolean addMonths(int delta)
          Public method addMonths() add a positive or negative number to the date.
 DatePickerDate addSpecialDay(java.util.Date date)
          Public method addSpecialDay() add a date to the list of special dates that require special formatting.
 DatePickerCell[] dayOfMonthNames()
          Public method dayOfMonthNames() returns an array of labels for days of a month in the default locale.
 DatePickerCell[] dayOfMonthNamesNext()
          Public method dayOfMonthNamesNext() returns an array of labels for days of the next month in the default locale.
 DatePickerCell[] dayOfMonthNamesPrev()
          Public method dayOfMonthNamesPrev() returns an array of labels for days of the previous month in the default locale.
static java.lang.String[] dayOfWeekNames()
          Public method dayOfWeekNames() returns an array of the names for days of a week in the default locale.
 void enableAdjacentMonths(boolean adjacentMonths)
          Public method enableAdjacentMonths() enables or disables the display of trailing and leading dates from previous and next months.
 int gridStart()
          Public method gridStart() returns the column number in the grid for the month start.
 boolean isYearBeforeMonth()
          Public method isYearBeforeMonth() returns whether the year is before month in the current locale or not.
 com.google.gwt.user.client.ui.Label monthName()
          Public method monthName() returns the name of the current month in the default locale.
 com.google.gwt.user.client.ui.ListBox monthNames()
          Public method monthNames() returns a ListBox containing the 12 month names in the default locale.
 int nextMonthDays()
          Public method nextMonthDays() returns number of days in the next month.
 int numSpecialDays()
          Public method numSpecialDays() returns number of dates for which special formatting is set.
 int prevMonthDays()
          Public method prevMonthDays() returns number of days in the previous month.
 void selectedDate(int monthType, int dayOfMonth)
          Public method selectedDate() sets the date user selected.
 void setFullDate(java.util.Date date)
          Public method selectedDate() sets to the given date.
 void setMonth(int month)
          Public method setMonth() sets to the given month.
 boolean setToday()
          Public method setToday() sets date to today's date.
 void setYear(int year)
          Public method setYear() sets to the given year.
 DatePickerDate specialDate(int i)
          Public method specialDate() returns a date from the list of dates that require special formatting.
 DatePickerCell todayCell()
          Public method todayCell() returns the Label for the cell displaying today's date.
 int weekendEnd()
          Public method weekendEnd() returns the day of the week on which weekend ends.
 int weekendStart()
          Public method weekendStart() returns the day of the week on which weekend starts.
 java.lang.String[] weekOfYear()
          Public method weekOfYear() returns a list of strings for week number of the year for the weeks displayed as per the locale set.
 int weekStart()
          Public method weekStart() returns the day of the week on which week starts as per the locale.
 com.google.gwt.user.client.ui.Label yearName()
          Public method yearName() returns the name of the current year in the default locale.
 com.google.gwt.user.client.ui.ListBox yearNames()
          Public method yearNames() returns a ListBox containing the 120 year names in the default locale.
 
Methods inherited from class com.google.gwt.widgetideas.datepicker.client.impl.DatePickerDate
currMonthSize, dayDiff, getDateAtDayStart, getDateAtMonthStart, prevMonthSize, setDate, setDayDiff, setTag, tag
 
Methods inherited from class java.util.Date
after, before, clone, compareTo, equals, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, setHours, setMinutes, setSeconds, setTime, toGMTString, toLocaleString, toString, UTC
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SELECTED

public static final int SELECTED
Constant SELECTED represents the user selected date in the grid.

See Also:
Constant Field Values

TODAY

public static final int TODAY
Constant TODAY represents today's date in the grid.

See Also:
Constant Field Values

TYPE_PREV_MONTH

public static final int TYPE_PREV_MONTH
Constant TYPE_PREV_MONTH represents the grid cells for the month previous to currently displayed one.

See Also:
Constant Field Values

TYPE_CURR_MONTH

public static final int TYPE_CURR_MONTH
Constant TYPE_CURR_MONTH represents the grid cells for currently displayed month.

See Also:
Constant Field Values

TYPE_NEXT_MONTH

public static final int TYPE_NEXT_MONTH
Constant TYPE_NEXT_MONTH represents the grid cells for the month next to currently displayed one.

See Also:
Constant Field Values

TYPE_CONTROL

public static final int TYPE_CONTROL
Constant TYPE_CONTROL represents the grid cell representing a control.

See Also:
Constant Field Values
Constructor Detail

LocaleCalendarUtils

public LocaleCalendarUtils(boolean adjacentMonths)
Public constructor for LocaleCalendarUtils class. It takes in a boolean parameter indicating whether to display some dates from adjacent months.

Method Detail

dayOfWeekNames

public static java.lang.String[] dayOfWeekNames()
Public method dayOfWeekNames() returns an array of the names for days of a week in the default locale.

Returns:
array of size 7 with names for days of a week in the locale

addMonths

public boolean addMonths(int delta)
Public method addMonths() add a positive or negative number to the date. The day of the month will be pinned to the original value as far as possible.

Overrides:
addMonths in class DatePickerDate
Parameters:
delta - - number of months to be added to the current date
Returns:
boolean - indicate whether change in year value happened or not

addSpecialDay

public DatePickerDate addSpecialDay(java.util.Date date)
Public method addSpecialDay() add a date to the list of special dates that require special formatting.

Parameters:
date - - date that require special formatting

dayOfMonthNames

public DatePickerCell[] dayOfMonthNames()
Public method dayOfMonthNames() returns an array of labels for days of a month in the default locale.

Returns:
array of size 31 with names for days of month in default locale

dayOfMonthNamesNext

public DatePickerCell[] dayOfMonthNamesNext()
Public method dayOfMonthNamesNext() returns an array of labels for days of the next month in the default locale.

Returns:
array of size 31 with names for days of the next month in the default locale

dayOfMonthNamesPrev

public DatePickerCell[] dayOfMonthNamesPrev()
Public method dayOfMonthNamesPrev() returns an array of labels for days of the previous month in the default locale.

Returns:
array of size 31 with names for days of the previous month in the default locale

enableAdjacentMonths

public void enableAdjacentMonths(boolean adjacentMonths)
Public method enableAdjacentMonths() enables or disables the display of trailing and leading dates from previous and next months.

Parameters:
adjacentMonths - - A boolean indicating whether display of trailing and leading dates from previous and next months.

gridStart

public int gridStart()
Public method gridStart() returns the column number in the grid for the month start.

Returns:
returns the column number in the grid for the month start.

isYearBeforeMonth

public boolean isYearBeforeMonth()
Public method isYearBeforeMonth() returns whether the year is before month in the current locale or not.

Returns:
returns whether the year is before month in the current locale or not.

monthName

public com.google.gwt.user.client.ui.Label monthName()
Public method monthName() returns the name of the current month in the default locale.

Returns:
returns the name of the current month in the default locale.

monthNames

public com.google.gwt.user.client.ui.ListBox monthNames()
Public method monthNames() returns a ListBox containing the 12 month names in the default locale. Current month would be the set as selected.

Returns:
returns a ListBox containing the 12 month names in the default locale.

nextMonthDays

public int nextMonthDays()
Public method nextMonthDays() returns number of days in the next month.

Returns:
number of days in the next month.

numSpecialDays

public int numSpecialDays()
Public method numSpecialDays() returns number of dates for which special formatting is set.

Returns:
number of number of dates for which special formatting is set.

prevMonthDays

public int prevMonthDays()
Public method prevMonthDays() returns number of days in the previous month.

Returns:
number of days in the previous month.

selectedDate

public void selectedDate(int monthType,
                         int dayOfMonth)
Public method selectedDate() sets the date user selected.

Parameters:
monthType - - Month type of the cell in which user clicked. Type can be current, previous or next month.
dayOfMonth - - Selected day of the month

setFullDate

public void setFullDate(java.util.Date date)
Public method selectedDate() sets to the given date.

Overrides:
setFullDate in class DatePickerDate
Parameters:
date - - Date to be set.

setMonth

public void setMonth(int month)
Public method setMonth() sets to the given month.

Overrides:
setMonth in class DatePickerDate
Parameters:
month - - Month to be set.

setToday

public boolean setToday()
Public method setToday() sets date to today's date. The tables exported by this class are changed accordingly.

Overrides:
setToday in class DatePickerDate
Returns:
Boolean reflecting whether year has been changed or not.

setYear

public void setYear(int year)
Public method setYear() sets to the given year.

Overrides:
setYear in class DatePickerDate
Parameters:
year - - Year to be set.

specialDate

public DatePickerDate specialDate(int i)
Public method specialDate() returns a date from the list of dates that require special formatting.

Parameters:
i - - position of the date entry in the special date list.

todayCell

public DatePickerCell todayCell()
Public method todayCell() returns the Label for the cell displaying today's date.


weekendEnd

public int weekendEnd()
Public method weekendEnd() returns the day of the week on which weekend ends. The range between 0 for Sunday and 6 for Saturday.

Returns:
the day of the week on which weekend ends.

weekendStart

public int weekendStart()
Public method weekendStart() returns the day of the week on which weekend starts. The range between 0 for Sunday and 6 for Saturday.

Returns:
the day of the week on which weekend starts.

weekOfYear

public java.lang.String[] weekOfYear()
Public method weekOfYear() returns a list of strings for week number of the year for the weeks displayed as per the locale set.

Returns:
List of strings for week number of the year for the weeks displayed as per the locale set.

weekStart

public int weekStart()
Public method weekStart() returns the day of the week on which week starts as per the locale. The range between 0 for Sunday and 6 for Saturday.

Returns:
the day of the week on which week starts as per the locale.

yearName

public com.google.gwt.user.client.ui.Label yearName()
Public method yearName() returns the name of the current year in the default locale.

Returns:
returns the name of the current year in the default locale.

yearNames

public com.google.gwt.user.client.ui.ListBox yearNames()
Public method yearNames() returns a ListBox containing the 120 year names in the default locale. Current year would be the set as selected.

Returns:
returns a ListBox containing the 120 year names in the default locale.