uic.widgets.calendar
Class UICCalendarModel

java.lang.Object
  extended by uic.widgets.calendar.UICCalendarModel
All Implemented Interfaces:
PropertyChangedAction.PropertyChangeCreator

public class UICCalendarModel
extends Object
implements PropertyChangedAction.PropertyChangeCreator

The model that holds the internal representation for the UICCalendar.

Since:
2.0
Author:
Stefan Rotman

Field Summary
static String PROPERTY_CHANGE_BOUNDS
           
static String PROPERTY_CHANGE_CALENDAR
           
static String PROPERTY_CHANGE_DATE
           
static String PROPERTY_CHANGE_MONTH
           
static String PROPERTY_CHANGE_WEEK
           
static String PROPERTY_CHANGE_YEAR
           
 
Constructor Summary
UICCalendarModel()
          Constructs a UICCalendarModel with the default Locale and today as the current date.
UICCalendarModel(Locale locale)
          Constructs a UICCalendarModel with the specified Locale and today as the current date.
UICCalendarModel(Locale locale, Calendar calendar)
          Constructs a UICCalendarModel with the specified locale and date.
UICCalendarModel(Locale locale, Calendar calendar, Calendar min, Calendar max)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
           
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
           
 Calendar getCalendar()
          Returns the model's calendar.
 int getDate()
          Returns the current date.
 int getDaysInMonth()
          Returns the number of days in the current month.
 int getDaysInNextMonth()
          Returns the number of days in the next month.
 int getDaysInPrevMonth()
          Returns the number of days in the previous month.
 int getFirstDayOfWeek()
          Returns the first day of the week.
 Locale getLocale()
          Returns the model's Locale.
 Calendar getMaxAllowedDate()
           
 Calendar getMinAllowedDate()
           
 int getMonth()
          Returns the current month.
 int getWeek()
          Returns the current week.
 int getYear()
          Returns the current year.
 void parse(String date)
          Parses the specified string as the new calendar data.
 void removePropertyChangeListener(PropertyChangeListener listener)
           
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
           
 void restoreBookmark()
          Restores the bookmark.
 void rollMonth(boolean up)
          Rolls the month one up or down.
 void rollYear(boolean up)
          Rolls the year one up or down.
 void setBookmark()
          Sets the bookmark to the current date.
 void setCalendar(Calendar calendar)
          Sets the specified calendar as the model's date.
 void setDate(int date)
          Changes the model to the specified date.
 void setMaxAllowedDate(Calendar maxAllowedDate)
           
 void setMinAllowedDate(Calendar minAllowedDate)
           
 void setMonth(int month)
          Changes the model to the specified month.
 void setWeek(int week)
          Changes the model to the specified week.
 void setYear(int year)
          Changes the model to the specified year.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_CHANGE_CALENDAR

public static final String PROPERTY_CHANGE_CALENDAR
See Also:
Constant Field Values

PROPERTY_CHANGE_YEAR

public static final String PROPERTY_CHANGE_YEAR
See Also:
Constant Field Values

PROPERTY_CHANGE_MONTH

public static final String PROPERTY_CHANGE_MONTH
See Also:
Constant Field Values

PROPERTY_CHANGE_DATE

public static final String PROPERTY_CHANGE_DATE
See Also:
Constant Field Values

PROPERTY_CHANGE_WEEK

public static final String PROPERTY_CHANGE_WEEK
See Also:
Constant Field Values

PROPERTY_CHANGE_BOUNDS

public static final String PROPERTY_CHANGE_BOUNDS
See Also:
Constant Field Values
Constructor Detail

UICCalendarModel

public UICCalendarModel()
Constructs a UICCalendarModel with the default Locale and today as the current date.


UICCalendarModel

public UICCalendarModel(Locale locale)
Constructs a UICCalendarModel with the specified Locale and today as the current date.

Parameters:
locale - the locale to use for this model.

UICCalendarModel

public UICCalendarModel(Locale locale,
                        Calendar calendar)
Constructs a UICCalendarModel with the specified locale and date.

Parameters:
locale - the locale to use for this model.
calendar - the Calendar to use as the initial date.

UICCalendarModel

public UICCalendarModel(Locale locale,
                        Calendar calendar,
                        Calendar min,
                        Calendar max)
Method Detail

getMaxAllowedDate

public Calendar getMaxAllowedDate()
Returns:
maxAllowedDate as Calendar.

setMaxAllowedDate

public void setMaxAllowedDate(Calendar maxAllowedDate)
Parameters:
maxAllowedDate - the value to set.

getMinAllowedDate

public Calendar getMinAllowedDate()
Returns:
minAllowedDate as Calendar.

setMinAllowedDate

public void setMinAllowedDate(Calendar minAllowedDate)
Parameters:
minAllowedDate - the value to set.

getLocale

public Locale getLocale()
Returns the model's Locale.

Returns:
the locale used by this model.

setBookmark

public void setBookmark()
Sets the bookmark to the current date.


restoreBookmark

public void restoreBookmark()
Restores the bookmark.


parse

public void parse(String date)
           throws ParseException
Parses the specified string as the new calendar data.

Parameters:
date - the String to parse.
Throws:
ParseException - if the String could not be parsed against the current locale.

setCalendar

public void setCalendar(Calendar calendar)
Sets the specified calendar as the model's date. Fires property change for PROPERTY_CHANGE_CALENDAR.

Parameters:
calendar - the Calendar to use as the current date.

getCalendar

public Calendar getCalendar()
Returns the model's calendar.


setDate

public void setDate(int date)
Changes the model to the specified date. Fires property change for PROPERTY_CHANGE_DATE.

Parameters:
date - the date (day in month) to set.

getDate

public int getDate()
Returns the current date.

Returns:
the current date (day in month).

rollMonth

public void rollMonth(boolean up)
Rolls the month one up or down.

Parameters:
up - if true the the month is changed to the next month, if false to the previous.

setMonth

public void setMonth(int month)
Changes the model to the specified month. Fires property change for PROPERTY_CHANGE_MONTH.

Parameters:
month - the month to set.

getMonth

public int getMonth()
Returns the current month.


rollYear

public void rollYear(boolean up)
Rolls the year one up or down.

Parameters:
up - if true the the year is changed to the next year, if false to the previous.

setYear

public void setYear(int year)
Changes the model to the specified year. Fires property change for PROPERTY_CHANGE_YEAR.

Parameters:
year - the year to set.

getYear

public int getYear()
Returns the current year.


setWeek

public void setWeek(int week)
Changes the model to the specified week. Fires property change for PROPERTY_CHANGE_WEEK.

Parameters:
week - the week to set.

getWeek

public int getWeek()
Returns the current week.


getFirstDayOfWeek

public int getFirstDayOfWeek()
Returns the first day of the week.


getDaysInMonth

public int getDaysInMonth()
Returns the number of days in the current month.


getDaysInPrevMonth

public int getDaysInPrevMonth()
Returns the number of days in the previous month.


getDaysInNextMonth

public int getDaysInNextMonth()
Returns the number of days in the next month.


addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface PropertyChangedAction.PropertyChangeCreator

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface PropertyChangedAction.PropertyChangeCreator

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)


Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence