JDatePicker v4.3

com.standbysoft.component.date.swing
Interface WeekModel

All Known Implementing Classes:
DefaultWeekModel

public interface WeekModel

A week model is a helper interface that lets you control various week settings for a JMonth component. The idea of this interface is to have a single point of control for various week aspects. It can:

See Also:
MonthModel, JMonth

Field Summary
static int NO_SELECTED_DOW
          Indicates that no day of week is selected.
static int NO_SELECTED_MONTH
          Indicates that no month is selected.
static int NO_SELECTED_WEEK
          Indicates that no week is selected.
static int NO_SELECTED_YEAR
          Indicates that no year is selected.
 
Method Summary
 void addWeekModelListener(WeekModelListener listener)
          Adds an object that listens to changes in this model.
 int getDowFirst()
          Returns the first day of week.
 java.lang.String[] getDowNames()
          Determines the names of the week days ordered as specified by the first day of week.
 int[] getDows()
          Returns the days of week starting with the first day of week.
 int getSelectedDow()
          Returns the day of week selected by this model.
 int getSelectedMonth()
          Returns the month to which the selected day of week belongs.
 int getSelectedWeek()
          Returns the number of the selected week from current year.
 int getSelectedYear()
          Returns the year to which the selected week belongs.
 int getWeekNumber(java.util.Date date, java.util.TimeZone timezone)
          Returns the week number for a specified date.
 boolean isDowSelectionAllowed()
          Determines whether days of week may be selected.
 boolean isWeekSelectionAllowed()
          Determines whether weeks of year may be selected.
 void removeWeekModelListener(WeekModelListener listener)
          Removes a specified listener from the list of registered listeners.
 void setDowFirst(int day)
          Specifies the first day of week.
 void setDowSelectionAllowed(boolean allowed)
          Specifies whether days of week may be selected.
 void setSelectedDow(int month, int dow)
          Specifies the day of week that is selected by this model.
 void setSelectedWeek(int year, int week)
          Selects a week from a specified year.
 void setWeekSelectionAllowed(boolean allowed)
          Specifies whether weeks of year may be selected.
 

Field Detail

NO_SELECTED_DOW

public static final int NO_SELECTED_DOW
Indicates that no day of week is selected.

See Also:
getSelectedDow(), Constant Field Values

NO_SELECTED_MONTH

public static final int NO_SELECTED_MONTH
Indicates that no month is selected.

See Also:
getSelectedMonth(), Constant Field Values

NO_SELECTED_WEEK

public static final int NO_SELECTED_WEEK
Indicates that no week is selected.

See Also:
getSelectedWeek(), Constant Field Values

NO_SELECTED_YEAR

public static final int NO_SELECTED_YEAR
Indicates that no year is selected.

See Also:
getSelectedYear(), Constant Field Values
Method Detail

addWeekModelListener

public void addWeekModelListener(WeekModelListener listener)
Adds an object that listens to changes in this model.

Parameters:
listener - the listener object that is informed about changes in this model

removeWeekModelListener

public void removeWeekModelListener(WeekModelListener listener)
Removes a specified listener from the list of registered listeners.

Parameters:
listener - the listener to be removed

getDowNames

public java.lang.String[] getDowNames()
Determines the names of the week days ordered as specified by the first day of week. The name of the first day corresponds to the first day from the list with the days of week.

Returns:
names of the week days.
See Also:
getDows(), getDowFirst()

getSelectedDow

public int getSelectedDow()
Returns the day of week selected by this model. Accepted values when a day is selected are the calendar constants: Calendar.SUNDAY, Calendar.MONDAY, etc. If no day of week is selected, then the method will return NO_SELECTED_DOW.

Returns:
day of week selected by this model.
See Also:
setSelectedDow(int, int), NO_SELECTED_DOW

getSelectedMonth

public int getSelectedMonth()
Returns the month to which the selected day of week belongs.

Returns:
month to which the selected dow belongs or NO_SELECTED_MONTH if no dow is selected.
See Also:
NO_SELECTED_MONTH, getSelectedDow(), setSelectedDow(int, int)

setSelectedDow

public void setSelectedDow(int month,
                           int dow)
Specifies the day of week that is selected by this model.

Parameters:
dow - day of week that is selected (Calendar.SUNDAY, Calendar.MONDAY, etc) or NO_SELECTED_DOW if no date should be selected
month - month to which the dow belongs
See Also:
NO_SELECTED_DOW, NO_SELECTED_MONTH

isDowSelectionAllowed

public boolean isDowSelectionAllowed()
Determines whether days of week may be selected.

Returns:
true if days of week may be selected and false otherwise
See Also:
setDowSelectionAllowed(boolean)

setDowSelectionAllowed

public void setDowSelectionAllowed(boolean allowed)
Specifies whether days of week may be selected. A day of week may be selected from a JMonth component if the respective day is clicked in the header.

Parameters:
allowed - if true, one may click on a day of week to select it.

getDowFirst

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

Returns:
the first day of week.
See Also:
setDowFirst(int)

getDows

public int[] getDows()
Returns the days of week starting with the first day of week.

Returns:
the days of week in order, starting with the first day of week. The values are values like Calendar.MONDAY.
See Also:
getDowFirst()

setDowFirst

public void setDowFirst(int day)
Specifies the first day of week.

Parameters:
day - day of week that is a java.util.Calendar constant like Calendar.MONDAY

getSelectedWeek

public int getSelectedWeek()
Returns the number of the selected week from current year.

Returns:
number of the selected week or NO_SELECTED_WEEK if no week is selected.
See Also:
NO_SELECTED_WEEK, getSelectedYear(), setSelectedWeek(int, int)

getSelectedYear

public int getSelectedYear()
Returns the year to which the selected week belongs.

Returns:
year to which the selected week belongs or NO_SELECTED_YEAR if no year is selected.
See Also:
NO_SELECTED_YEAR, getSelectedWeek(), setSelectedWeek(int, int)

setSelectedWeek

public void setSelectedWeek(int year,
                            int week)
Selects a week from a specified year.

Parameters:
year - specified year
week - specified week
See Also:
NO_SELECTED_WEEK, NO_SELECTED_YEAR

isWeekSelectionAllowed

public boolean isWeekSelectionAllowed()
Determines whether weeks of year may be selected.

Returns:
true if weeks of week may be selected and false otherwise
See Also:
setWeekSelectionAllowed(boolean)

setWeekSelectionAllowed

public void setWeekSelectionAllowed(boolean allowed)
Specifies whether weeks of year may be selected. A week of year may be selected from a JMonth component if the respective week number is clicked.

Parameters:
allowed - if true, one may click on a week of year to select it.

getWeekNumber

public int getWeekNumber(java.util.Date date,
                         java.util.TimeZone timezone)
Returns the week number for a specified date. It can be implemented to return any suitable value. In most cases, its implementation should return values from 1 to 52 or from 1 to 53 if ISO representation is required.

Parameters:
date - date for which the week number is computed
timezone - time zone used with the date to extract the week number
Returns:
week number for the specified date

JDatePicker v4.3

Visit www.jdatepicker.com for further information or send us your suggestions.

Copyright © 2003-2007 Stand By Soft Ltd. All Rights Reserved.