com.webmethods.caf.faces.data.calendar
Class CalendarEventProvider

java.lang.Object
  extended by com.webmethods.caf.faces.data.calendar.CalendarEventProvider
All Implemented Interfaces:
ICalendarEventProvider

public class CalendarEventProvider
extends Object
implements ICalendarEventProvider

Simple provider wrapper around a list of ICalendarEvents


Field Summary
protected  List m_eventList
           
protected  List m_filteredEventList
           
protected  Date m_filterEndDate
           
protected  Date m_filterStartDate
           
 
Constructor Summary
CalendarEventProvider()
          Default constructor
CalendarEventProvider(ICalendarEvent[] eventsArray)
          Constructor to set the list of calendar events for this provider from a array.
CalendarEventProvider(List eventsList)
          Constructor to set the list of calendar events for this provider.
 
Method Summary
static void filterCalendarEventList(List in, List out, Date startDate, Date endDate)
           
 Date getEndDate()
          Get the end date, of the date range, used in filtering the list of calendar events
 List getEventList()
          Get the list of events contained by this provider.
protected  List getFilteredEventList()
          Filter the event list using the start and end dates.
 Date getStartDate()
          Get the start date, of the date range, used in filtering the list of calendar events
protected  boolean hasFilter()
          Determines if the start or end date have been set.
 void setEndDate(Date endDate)
          Set the end date of the date range for this provider.
 void setEventList(List eventList)
          Set the event list of calendar events for this provider.
 void setStartDate(Date startDate)
          Set the start date of the date range for this provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_eventList

protected List m_eventList

m_filteredEventList

protected List m_filteredEventList

m_filterStartDate

protected Date m_filterStartDate

m_filterEndDate

protected Date m_filterEndDate
Constructor Detail

CalendarEventProvider

public CalendarEventProvider()
Default constructor


CalendarEventProvider

public CalendarEventProvider(List eventsList)
Constructor to set the list of calendar events for this provider.

Parameters:
eventsList - A list of ICalendarEvent objects.

CalendarEventProvider

public CalendarEventProvider(ICalendarEvent[] eventsArray)
Constructor to set the list of calendar events for this provider from a array.

Parameters:
eventsArray - An array of ICalendarEvent objects.
Method Detail

getEventList

public List getEventList()
Get the list of events contained by this provider. If the start date or end date are not defined then the entire list is returned. Otherwise a list of calendar events that occur after the start date and before the end date are returned.

Specified by:
getEventList in interface ICalendarEventProvider
Returns:
List A list of events for this provider. If list is null, returns EMPTY_LIST

setEventList

public void setEventList(List eventList)
Set the event list of calendar events for this provider.

Parameters:
eventList - List of calendar events.

setStartDate

public void setStartDate(Date startDate)
Set the start date of the date range for this provider. Setting the date to null, clears the start date. Clears filtered list of calendar events.

Specified by:
setStartDate in interface ICalendarEventProvider
Parameters:
startDate - The date to exclude events before this date

getStartDate

public Date getStartDate()
Get the start date, of the date range, used in filtering the list of calendar events

Returns:
The date object passed in by setStartDate.

setEndDate

public void setEndDate(Date endDate)
Set the end date of the date range for this provider. Setting the date to null, clears the end date. Clears filtered list of calendar events.

Specified by:
setEndDate in interface ICalendarEventProvider
Parameters:
endDate - The date to exclude events after this date

getEndDate

public Date getEndDate()
Get the end date, of the date range, used in filtering the list of calendar events

Returns:
The date object passed in by setEndDate.

hasFilter

protected boolean hasFilter()
Determines if the start or end date have been set. Setting either to null, clear them.

Returns:
True if end or start date are set, otherwise false.

getFilteredEventList

protected List getFilteredEventList()
Filter the event list using the start and end dates. Cache the results. This excludes all events before the start date and after the end date. A start date must be defined or the list will be empty. A end date is optional.

Returns:
A list of calendar events bound by the start and end date.

filterCalendarEventList

public static void filterCalendarEventList(List in,
                                           List out,
                                           Date startDate,
                                           Date endDate)