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

java.lang.Object
  extended by com.webmethods.caf.faces.data.calendar.CalendarUnit

public class CalendarUnit
extends Object

Holder class to present calendar unit information. Represents a unit of date measurement. The types are defined by the provider. The DefaultCalendarProvider uses day, week, month, year.

See Also:
DefaultCalendarProvider

Field Summary
protected  Date endDate
           
protected  Date startDate
           
protected  int unitIndex
           
protected  String units
           
 
Constructor Summary
CalendarUnit()
          Default constructor
CalendarUnit(Date startDate, Date endDate, int unitIndex, String units)
          Constructor to initialize the calendar unit's values.
 
Method Summary
 Date getEndDate()
          Get the end date of this unit.
 Date getStartDate()
          Get the start date of this unit.
 int getUnitIndex()
          Get the current day within this unit of measure.
 String getUnits()
          Get the unit of measure.
 void setEndDate(Date endDate)
          Set the end date of this unit.
 void setStartDate(Date startDate)
          Set the start date of this unit.
 void setUnitIndex(int unitIndex)
          Set the index of the current day within this unit of measure.
 void setUnits(String units)
          Set the unit of measure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

startDate

protected Date startDate

endDate

protected Date endDate

unitIndex

protected int unitIndex

units

protected String units
Constructor Detail

CalendarUnit

public CalendarUnit()
Default constructor


CalendarUnit

public CalendarUnit(Date startDate,
                    Date endDate,
                    int unitIndex,
                    String units)
Constructor to initialize the calendar unit's values.

Parameters:
startDate - The start date for this unit. May not be null.
endDate - The end date for this unit. May not be null.
unitIndex - The index of a Day within this unit.
units - The type of unit. ( day, week, month, year )
Method Detail

getEndDate

public Date getEndDate()
Get the end date of this unit.

Returns:
The end date this unit

setEndDate

public void setEndDate(Date endDate)
Set the end date of this unit. May not be null. End date should differ from the start date by an amount based on the unit type.

Parameters:
endDate - The end date this unit.

getStartDate

public Date getStartDate()
Get the start date of this unit.

Returns:
The end date this unit.

setStartDate

public void setStartDate(Date startDate)
Set the start date of this unit. May not be null.

Parameters:
startDate - The start date this unit.

getUnitIndex

public int getUnitIndex()
Get the current day within this unit of measure. Example, an index of two for a calendar unit of a week, would be Monday the second day of the week. This assumes a week that starts on Sunday.

Returns:
The index of the day, starting at one.

setUnitIndex

public void setUnitIndex(int unitIndex)
Set the index of the current day within this unit of measure.

Parameters:
unitIndex - An index value that starts at one.

getUnits

public String getUnits()
Get the unit of measure. (day, week, month, year)

Returns:
The text type for this calendar unit.
See Also:
DefaultCalendarProvider

setUnits

public void setUnits(String units)
Set the unit of measure. (day, week, month, year) DefaultCalendarProvider defines the unit types day, week, month, and year.

Parameters:
units - A text value for the calendar unit type.
See Also:
DefaultCalendarProvider