caltool.view
Class YearlyCalendar

java.lang.Object
  extended by java.util.Observable
      extended by mvp.Model
          extended by caltool.view.YearlyCalendar
All Implemented Interfaces:
java.io.Serializable

public class YearlyCalendar
extends mvp.Model

A YearlyCalendar contains a small view for each month, organized in four 3-month rows. The primarly access interface is through getFirstDay and getNumberOfDays methods. These methods take a month name and deliver the first day of that month and its number of days, respectively.

Since the yearly calendar contains no scheduled data itself, there is no need for any model data storage here. Rather, the access methods consult the calendar db to dynamically generate the date number values for each month.

See Also:
Serialized Form

Field Summary
protected  int yearNumber
          The number of the year, between 0 and 9999
 
Fields inherited from class mvp.Model
view
 
Constructor Summary
YearlyCalendar(CalendarDB calDB)
          Construct this with the given CalendarDB.
 
Method Summary
 DayName getFirstDay(MonthName month)
          Return the first day of the given month.
 int getNumberOfDays(MonthName month)
          Return the number of days in the given month.
 int getNumberOfWeeks(MonthName month)
          Return the number of weeks in the given month.
 int getYearNumber()
          Return the year number.
 void update(java.util.Observable o, java.lang.Object arg)
          Update this' data based on the current selection in the current calendar.
 
Methods inherited from class mvp.Model
dump, exit, getView, setView
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

yearNumber

protected int yearNumber
The number of the year, between 0 and 9999

Constructor Detail

YearlyCalendar

public YearlyCalendar(CalendarDB calDB)
Construct this with the given CalendarDB. Call update to get the data values for the initially current year.

Method Detail

getYearNumber

public int getYearNumber()
Return the year number.


getFirstDay

public DayName getFirstDay(MonthName month)
Return the first day of the given month. For initial testing purposes, this method is hard-wired with the sample year shown in Section 2.3.1.4 of the requirements. In the actual implementation, it will consult the calendar db.


getNumberOfWeeks

public int getNumberOfWeeks(MonthName month)
Return the number of weeks in the given month.


getNumberOfDays

public int getNumberOfDays(MonthName month)
Return the number of days in the given month. For initial testing purposes, this method ignores leap years. In the actual implementation, it will cosult the calendar db to determine the number of days for february in the selected year.


update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Update this' data based on the current selection in the current calendar. For initial testing purposes, the fixed year of 1998 is created, details of which are shown in Section 2.3.1.4 of the requirements. In the refined implementation, the calendar db will be consulted to obtain the actual information for the currently selected year.