## org.apache.myfaces.custom.schedule.model
Class AbstractScheduleModel

    java.lang.Object
      org.apache.myfaces.custom.schedule.model.AbstractScheduleModel

All Implemented Interfaces:
  ScheduleModel

Direct Known Subclasses:
  SimpleScheduleModel

public abstract class AbstractScheduleModel
extends java.lang.Object
implements ScheduleModel

Extend this class to create your own implementation of a ScheduleModel

Version:
  $Revision$
Author:
  Jurgen Lust (latest modification by $Author$)

Field Summary
`protected java.util.TreeSet` `days`

Fields inherited from interface org.apache.myfaces.custom.schedule.model.ScheduleModel
`DAY, MONTH, WEEK, WORKWEEK`

Constructor Summary
`AbstractScheduleModel()` Creates a new AbstractScheduleModel object.

Method Summary
`protected ScheduleDay` `add(java.util.Date date)` Add a day to the schedule
`protected void` `clear()` Remove all days
`boolean` `containsDate(java.util.Date date)` Check if the schedule contains the specified date
`java.lang.Object` `get(int index)` Get the day at position index.
`int` `getMode()`
`java.util.Date` `getSelectedDate()`
`ScheduleEntry` `getSelectedEntry()`
`boolean` `isEmpty()`
`java.util.Iterator` `iterator()`
`protected abstract void` `loadDayAttributes(Day day)` Load any attributes for this day: is it a working day or a holiday, and what is the name of the day (e.g.
`protected abstract java.util.Collection` `loadEntries(java.util.Date startDate, java.util.Date endDate)` Load the schedule entries that fall between the startDate and the endDate.
`void` `refresh()` This refreshes the visible days of the model
`protected void` `setDay(java.util.Date date)` Set the day
`void` `setMode(int mode)`
`protected void` `setMonth(java.util.Date date)` navigate to the specified month
`void` `setSelectedDate(java.util.Date date)`
`void` `setSelectedEntry(ScheduleEntry selectedEntry)`
`protected void` `setWeek(java.util.Date date)` navigate to the specified week
`protected void` `setWorkWeek(java.util.Date date)` navigate to the specified workweek
`int` `size()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### days

    protected final java.util.TreeSet days

Constructor Detail

### AbstractScheduleModel

    public AbstractScheduleModel()

  Creates a new AbstractScheduleModel object.

Method Detail

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `ScheduleModel`
  Returns:
    true if there are no entries
  See Also:
    `ScheduleModel.isEmpty()`

### setMode

    public void setMode(int mode)

  Specified by:
    `setMode` in interface `ScheduleModel`
  Parameters:
    `mode` - the mode: DAY, WORKWEEK, WEEK or MONTH
  See Also:
    `ScheduleModel.setMode(int)`

### getMode

    public int getMode()

  Specified by:
    `getMode` in interface `ScheduleModel`
  Returns:
    the mode: DAY, WORKWEEK, WEEK or MONTH
  See Also:
    `ScheduleModel.getMode()`

### setSelectedDate

    public void setSelectedDate(java.util.Date date)

  Specified by:
    `setSelectedDate` in interface `ScheduleModel`
  Parameters:
    `date` - the date to select
  See Also:
    `ScheduleModel.setSelectedDate(java.util.Date)`

### getSelectedDate

    public java.util.Date getSelectedDate()

  Specified by:
    `getSelectedDate` in interface `ScheduleModel`
  Returns:
    the selected date
  See Also:
    `ScheduleModel.getSelectedDate()`

### setSelectedEntry

    public void setSelectedEntry(ScheduleEntry selectedEntry)

  Specified by:
    `setSelectedEntry` in interface `ScheduleModel`
  Parameters:
    `selectedEntry` - the entry to select
  See Also:
    `ScheduleModel.setSelectedEntry(org.apache.myfaces.custom.schedule.model.ScheduleEntry)`

### getSelectedEntry

    public ScheduleEntry getSelectedEntry()

  Specified by:
    `getSelectedEntry` in interface `ScheduleModel`
  Returns:
    the selected entry
  See Also:
    `ScheduleModel.getSelectedEntry()`

### containsDate

    public boolean containsDate(java.util.Date date)

  Description copied from interface: `ScheduleModel`

  Check if the schedule contains the specified date

  Specified by:
    `containsDate` in interface `ScheduleModel`
  Parameters:
    `date` - the date to check
  Returns:
    whether the schedule containts this date
  See Also:
    `ScheduleModel.containsDate(java.util.Date)`

### get

    public java.lang.Object get(int index)

  Description copied from interface: `ScheduleModel`

  Get the day at position index.

  Specified by:
    `get` in interface `ScheduleModel`
  Parameters:
    `index` - the index
  Returns:
    the day
  See Also:
    `ScheduleModel.get(int)`

### iterator

    public java.util.Iterator iterator()

  Specified by:
    `iterator` in interface `ScheduleModel`
  Returns:
    an iterator for the days
  See Also:
    `ScheduleModel.iterator()`

### size

    public int size()

  Specified by:
    `size` in interface `ScheduleModel`
  Returns:
    the number of days in this model
  See Also:
    `ScheduleModel.size()`

### setDay

    protected void setDay(java.util.Date date)

  Set the day

  Parameters:
    `date` - the new day

### setMonth

    protected void setMonth(java.util.Date date)

  navigate to the specified month

  Parameters:
    `date` - the date to navigate to

### setWeek

    protected void setWeek(java.util.Date date)

  navigate to the specified week

  Parameters:
    `date` - the date to navigate to

### setWorkWeek

    protected void setWorkWeek(java.util.Date date)

  navigate to the specified workweek

  Parameters:
    `date` - the date to navigate to

### add

    protected ScheduleDay add(java.util.Date date)

  Add a day to the schedule

  Returns:
    the day that was added

### clear

    protected void clear()

  Remove all days

### refresh

    public void refresh()

  This refreshes the visible days of the model

### loadEntries

    protected abstract java.util.Collection loadEntries(java.util.Date startDate,
                                                        java.util.Date endDate)

  Load the schedule entries that fall between the startDate and the endDate.

  Parameters:
    `startDate` - 0 AM on the start date
    `endDate` - 12 PM on the end date

### loadDayAttributes

    protected abstract void loadDayAttributes(Day day)

  Load any attributes for this day: is it a working day or a holiday, and what is the name of the day (e.g. "Christmas").

  Parameters:
    `day` - the day that should be loaded