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

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

public class DatePickerDate
extends java.util.Date

DatePickerDate public class is used by DatePicker UI class. This class does the following extra calendar calculations required for displaying dates in a grid:

See Also:
Serialized Form

Method Summary
 boolean addMonths(int deltaMonths)
          Public method addMonths() add a positive or negative number to the date.
 int currMonthSize()
          Public method currMonthSize() returns size of the current month
 int dayDiff()
          Public method dayDiff() returns difference in days from the date given for setDayDiff().
static java.util.Date getDateAtDayStart()
          Public static method getDateAtDayStart() return the Date object with time set to 00:00:00.
static java.util.Date getDateAtMonthStart()
          Public static method getDateAtMonthStart() return the Date object with date set to 1 and time set to 00:00:00.
 int prevMonthSize()
          Public method prevMonthSize() returns size of the month previous to current one.
 void setDate(int date)
          Public method setDate() sets the day of the month to the given value.
 void setDayDiff(java.util.Date date, int offset)
          Public method setDayDiff() stores the difference in days from a given date, plus a given offset.
 void setFullDate(java.util.Date date)
          Public method setFullDate() sets the given date.
 void setMonth(int month)
          Public method setMonth() sets the month to the given value.
 void setTag(java.lang.String tag)
          Public method setTag() sets a string tag
 boolean setToday()
          Public method setToday() resets the date to today's date.
 void setYear(int year)
          Public method setYear() sets the year to the given value.
 java.lang.String tag()
          Public method tag() gets the a string tag assigned
 
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
 

Method Detail

getDateAtDayStart

public static java.util.Date getDateAtDayStart()
Public static method getDateAtDayStart() return the Date object with time set to 00:00:00. Keeping a fixed the time of day intended to make it easier to find day differences of dates that are initiated to different times of the day.

Returns:
new Date object

getDateAtMonthStart

public static java.util.Date getDateAtMonthStart()
Public static method getDateAtMonthStart() return the Date object with date set to 1 and time set to 00:00:00.

Returns:
new Date object

addMonths

public boolean addMonths(int deltaMonths)
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.

Parameters:
deltaMonths - - number of months to be added to the current date
Returns:
boolean - indicate whether change in year value happened or not

currMonthSize

public int currMonthSize()
Public method currMonthSize() returns size of the current month

Returns:
number of days in the current month

dayDiff

public int dayDiff()
Public method dayDiff() returns difference in days from the date given for setDayDiff().

Returns:
difference in number of days.

prevMonthSize

public int prevMonthSize()
Public method prevMonthSize() returns size of the month previous to current one.

Returns:
number of days in the previous month

setDate

public void setDate(int date)
Public method setDate() sets the day of the month to the given value. It also sets that as the pinned value for day of the month.

Overrides:
setDate in class java.util.Date
Parameters:
date - - day of the month to be set

setDayDiff

public void setDayDiff(java.util.Date date,
                       int offset)
Public method setDayDiff() stores the difference in days from a given date, plus a given offset.

Parameters:
date - - the date from which difference has to be computed
offset - - the offset to be added to the set value

setFullDate

public void setFullDate(java.util.Date date)
Public method setFullDate() sets the given date. However, the time of the day is set to 00:00:00 so that it should not affect the computations. Similarly, the pinned date is also set to the day of the month of the date given.

Parameters:
date - - date to be set

setMonth

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

Overrides:
setMonth in class java.util.Date
Parameters:
month - - month to be set

setTag

public void setTag(java.lang.String tag)
Public method setTag() sets a string tag

Parameters:
tag - - a string tag

setToday

public boolean setToday()
Public method setToday() resets the date to today's date. Pinned date value would be set to day of the month for today.

Returns:
boolean - indicate whether change in year value happened or not

setYear

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

Overrides:
setYear in class java.util.Date
Parameters:
year - - year to be set

tag

public java.lang.String tag()
Public method tag() gets the a string tag assigned

Returns:
tag - assigned string tag