Java Date Picker v2.0.0

com.standbysoft.datepicker
Class DefaultMonthModel

java.lang.Object
  |
  +--com.standbysoft.datepicker.DefaultMonthModel
All Implemented Interfaces:
MonthModel

public class DefaultMonthModel
extends java.lang.Object
implements MonthModel

A default implementation for a MonthModel.

Author:
Nicolae Cismaru

Fields inherited from interface com.standbysoft.datepicker.MonthModel
DOW_NAMES_LONG, DOW_NAMES_SHORT, MONTH_NAMES_LONG, MONTH_NAMES_SHORT
 
Constructor Summary
DefaultMonthModel()
           
DefaultMonthModel(java.util.Locale locale)
           
DefaultMonthModel(java.util.Locale locale, int dowFormat, int monthFormat)
           
DefaultMonthModel(java.util.Locale locale, int dowFirst, int dowFormat, int monthFormat)
           
 
Method Summary
 void addMonthModelListener(MonthModelListener listener)
          Adds an object that listens to changes in this model.
 int getDowFirst()
          Returns the first day of week.
 int getDowIndex(int day)
          Returns the index of a specified day in a week.
 int getDowNamesFormat()
          Returns what format the names of days of week have.
 int[] getDows()
          Returns the days of week starting with the first day of week.
 java.util.EventListener[] getListeners(java.lang.Class listenerType)
           
 java.util.Date getMaximumAllowed()
          Returns the maximum allowed date that can be represented by this model.
 java.util.Date getMinimumAllowed()
          Returns the minimum allowed date that can be represented by this model.
 int getMonth()
          Returns the month represented by this model.
 int getMonthNamesFormat()
          Returns what format the names of months have.
 int getYear()
          Returns the year to which the represented month belongs.
 boolean isMonthInRange(int month, int year)
          Determines whether a specified month is in the allowed date range.
 void removeMonthModelListener(MonthModelListener listener)
          Removes a specified listener from the list of registered listeners.
 void rollMonth(boolean up)
          Rolls one month up or down.
 void rollYear(boolean up)
          Rolls one year up or down.
 void setDowFirst(int day)
          Specifies the first day of week.
 void setDowFormat(int format)
           
 void setMaximumAllowed(java.util.Date maximum)
           
 void setMinimumAllowed(java.util.Date minimum)
           
 void setMonth(int month)
          Specifies a new month to be represented by this model.
 void setMonthFormat(int format)
           
 void setYear(int year)
          Specifies a new year to which the represented month belongs.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMonthModel

public DefaultMonthModel()

DefaultMonthModel

public DefaultMonthModel(java.util.Locale locale)

DefaultMonthModel

public DefaultMonthModel(java.util.Locale locale,
                         int dowFormat,
                         int monthFormat)

DefaultMonthModel

public DefaultMonthModel(java.util.Locale locale,
                         int dowFirst,
                         int dowFormat,
                         int monthFormat)
Method Detail

getDows

public int[] getDows()
Description copied from interface: MonthModel
Returns the days of week starting with the first day of week.
Specified by:
getDows in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Returns:
the days of week in order, starting with the first day of week. The values are values like Calendar.MONDAY.
See Also:
MonthModel.getDowFirst()

getDowIndex

public int getDowIndex(int day)
Description copied from interface: MonthModel
Returns the index of a specified day in a week. The week is considered to start with the first day of week which has the index 0.
Specified by:
getDowIndex in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Parameters:
day - day of week for which the index is requested. The values are values like Calendar.MONDAY.
Returns:
the index of the specified day in a week. Values are in the range 0..6.
See Also:
MonthModel.getDowFirst()

setDowFormat

public void setDowFormat(int format)

getDowNamesFormat

public int getDowNamesFormat()
Description copied from interface: MonthModel
Returns what format the names of days of week have.
Specified by:
getDowNamesFormat in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Returns:
the format that the names of days of week have

setMonthFormat

public void setMonthFormat(int format)

getMonthNamesFormat

public int getMonthNamesFormat()
Description copied from interface: MonthModel
Returns what format the names of months have.
Specified by:
getMonthNamesFormat in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Returns:
the format that the names of months have

setDowFirst

public void setDowFirst(int day)
Description copied from interface: MonthModel
Specifies the first day of week.
Specified by:
setDowFirst in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Parameters:
day - day of week that is a java.util.Calendar constant like Calendar.MONDAY

getDowFirst

public int getDowFirst()
Description copied from interface: MonthModel
Returns the first day of week.
Specified by:
getDowFirst in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Returns:
the first day of week.

setMinimumAllowed

public void setMinimumAllowed(java.util.Date minimum)

setMaximumAllowed

public void setMaximumAllowed(java.util.Date maximum)

getMinimumAllowed

public java.util.Date getMinimumAllowed()
Description copied from interface: MonthModel
Returns the minimum allowed date that can be represented by this model. Months below this minimum date cannot be represented by this model. If the minimum allowed date is null then there is no restriction.
Specified by:
getMinimumAllowed in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Returns:
the minimum allowed date that can be represented by this model or null.

getMaximumAllowed

public java.util.Date getMaximumAllowed()
Description copied from interface: MonthModel
Returns the maximum allowed date that can be represented by this model. Months after this maximum date cannot be represented by this model. If the maximum allowed date is null then there is no restriction.
Specified by:
getMaximumAllowed in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Returns:
the maximum allowed date that can be represented by this model or null.

setMonth

public void setMonth(int month)
Description copied from interface: MonthModel
Specifies a new month to be represented by this model. The month will be the month of the current year. Only months that belong to the allowed dates interval are valid.
Specified by:
setMonth in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Parameters:
month - new month to be used by this model. The values are Calendar constants like Calendar.JANUARY.
See Also:
MonthModel.getYear()

setYear

public void setYear(int year)
Description copied from interface: MonthModel
Specifies a new year to which the represented month belongs. Only years that belong to the allowed dates interval are valid.
Specified by:
setYear in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Parameters:
year - year to which the represented month belongs.

isMonthInRange

public boolean isMonthInRange(int month,
                              int year)
Description copied from interface: MonthModel
Determines whether a specified month is in the allowed date range.
Specified by:
isMonthInRange in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Parameters:
month - month that is tested
year - year to which the month belongs
Returns:
true if the secified month is in the allowed date range or false otherwise.

rollMonth

public void rollMonth(boolean up)
Description copied from interface: MonthModel
Rolls one month up or down.
Specified by:
rollMonth in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Parameters:
up - true if the month is rolled up and false if the month is rolled down

rollYear

public void rollYear(boolean up)
Description copied from interface: MonthModel
Rolls one year up or down. If this operation leads to a month that is out of range then the border month is selected.
Specified by:
rollYear in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Parameters:
up - true if the year is rolled up and false if the year is rolled down

getMonth

public int getMonth()
Description copied from interface: MonthModel
Returns the month represented by this model.
Specified by:
getMonth in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Returns:
month represented by this model as a Calendar constant like Calendar.JANUARY.
See Also:
MonthModel.getYear()

getYear

public int getYear()
Description copied from interface: MonthModel
Returns the year to which the represented month belongs.
Specified by:
getYear in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Returns:
the year to which the represented month belongs.
See Also:
MonthModel.getMonth()

addMonthModelListener

public void addMonthModelListener(MonthModelListener listener)
Description copied from interface: MonthModel
Adds an object that listens to changes in this model.
Specified by:
addMonthModelListener in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Parameters:
listener - the listener object that is informed about changes in this model

removeMonthModelListener

public void removeMonthModelListener(MonthModelListener listener)
Description copied from interface: MonthModel
Removes a specified listener from the list of registered listeners.
Specified by:
removeMonthModelListener in interface MonthModel
Following copied from interface: com.standbysoft.datepicker.MonthModel
Parameters:
listener - the listener to be removed

getListeners

public java.util.EventListener[] getListeners(java.lang.Class listenerType)

Java Date Picker v2.0.0

Copyright © 2003 Standby Soft Ltd. All Rights Reserved.