Class DefaultCalendarProvider
java.lang.Object
com.webmethods.caf.faces.bean.PageFlowScopeAdapter
com.webmethods.caf.faces.data.object.DefaultCalendarProvider
- All Implemented Interfaces:
IPageFlowScopeAdapter
,ICalendarProvider
,IContentProvider
,ITableContentProvider
DefaultCalendarProvider represents the default implementation
for
ICalendarProvider
.
Provides a slice of calendar days to a table where each row represents a
calendar day. The index indicates the date offset from the provider start date-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.ibm.icu.util.Calendar
protected CalendarUnit
protected int
protected String
protected Date
protected boolean
protected Date
protected Locale
protected int
protected Date
protected com.ibm.icu.util.TimeZone
protected int
protected String
protected static final long
static final String
static final String
static final String
static final String
Fields inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
fExpireWithPageFlow
-
Constructor Summary
ConstructorsConstructorDescriptionDefault construtor using the default locale, time zone, and calendar.DefaultCalendarProvider
(Date startDate, Date endDate, Locale locale, com.ibm.icu.util.TimeZone timeZone) Construct new instance using locale, time zone provided.DefaultCalendarProvider
(Date startDate, Locale locale, com.ibm.icu.util.TimeZone timeZone) Construct new instance using locale, time zone provided.DefaultCalendarProvider
(Locale locale, com.ibm.icu.util.TimeZone timeZone) Construct new instance using locale, time zone provided. -
Method Summary
Modifier and TypeMethodDescriptionprotected Date
protected int
calcIndexFromDate
(Date date) protected Date
calcUnitStartDate
(Date date) Get the day at the current day index within the current calendar unit.Returns current row.Get the current aligned calendar unit index, expressed as the number of calendar units from the provider start dateint
Get the number of days within the current calendar unit.Get the end date of the date range for this provider.Get the initial date to display.int
Get the number of calendar units in this provider.Object[]
Returns list of properties supported by this content provider.int
Return the number of rows of data objects represented by this DataModel.int
Return the zero-relative index of the currently selected row.Returns row variable name.Get the start date of the date range for this provider.Class<?>
Returns java type of the given propertyint
Get the number of calendar units in this provider.get the last day date in the current unit row (e.g.getUnits()
Get the calendar unit of measure for this provider.get the first day date in the current unit row (e.g.Get the name of the request variable that current CalendarUnit will be exposed as.Returns value of the given propertyboolean
hasProperty
(Object propertyKey) Checks if the given property is supported by this content providervoid
initialize
(String units, Date startDate, Date endDate, Date initialDate, int numDisplayUnits) Common method to set the content of the calendar provider.boolean
Is the day selected by setDayIndex within the start and end dates of the current calendar unit.boolean
Determine if method initialize has been called.boolean
Return a flag indicating whether there is rowData available at the current rowIndex.boolean
void
setDayIndex
(int dayIndex) Set the index of the day within the current calendar unit.void
setEndDate
(Date date) Set the end date for the date range for this providervoid
setInitialDate
(Date initialDate) Set the initial date to display.void
setNumUnits
(int units) Set the the number of calendar unitsvoid
setRowIndex
(int rowIndex) Set row index.void
setRowVariable
(String var) Sets row variable name to use for accessing row specific data.void
setStartDate
(Date date) Set the start date of the date range for this provider.void
setUnitIndex
(int unitIndex) Set the current aligned calendar unit index, expressed as the number of calendar units from the provider start datevoid
Set the calendar unit of measure for this provider.void
setUnitVariable
(String var) Set the name of the request variable that current Calendar Unit will be exposed as.toString()
Returns string representation of content.Methods inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
getExpireWithPageFlow, setExpireWithPageFlow
-
Field Details
-
m_init
protected boolean m_init -
m_unitIndex
protected int m_unitIndex -
m_dayIndex
protected int m_dayIndex -
m_units
-
m_startDate
-
m_endDate
-
m_initialDate
-
m_numUnits
protected int m_numUnits -
m_calendarUnit
-
m_calendar
protected com.ibm.icu.util.Calendar m_calendar -
m_locale
-
m_timeZone
protected com.ibm.icu.util.TimeZone m_timeZone -
m_dayVar
-
UNIT_DAY
- See Also:
-
UNIT_WEEK
- See Also:
-
UNIT_MONTH
- See Also:
-
UNIT_YEAR
- See Also:
-
MS_IN_DAY
protected static final long MS_IN_DAY- See Also:
-
-
Constructor Details
-
DefaultCalendarProvider
public DefaultCalendarProvider()Default construtor using the default locale, time zone, and calendar. -
DefaultCalendarProvider
Construct new instance using locale, time zone provided.- Parameters:
locale
-timeZone
-
-
DefaultCalendarProvider
Construct new instance using locale, time zone provided. Also set start date.- Parameters:
startDate
-locale
-timeZone
-
-
DefaultCalendarProvider
public DefaultCalendarProvider(Date startDate, Date endDate, Locale locale, com.ibm.icu.util.TimeZone timeZone) Construct new instance using locale, time zone provided. Also set start date and end date.- Parameters:
startDate
-endDate
-locale
-timeZone
-
-
-
Method Details
-
isInitialized
public boolean isInitialized()Description copied from interface:ICalendarProvider
Determine if method initialize has been called.- Specified by:
isInitialized
in interfaceICalendarProvider
- Returns:
- boolean true if method initialize has been called, otherwise false.
-
initialize
public void initialize(String units, Date startDate, Date endDate, Date initialDate, int numDisplayUnits) Description copied from interface:ICalendarProvider
Common method to set the content of the calendar provider.- Specified by:
initialize
in interfaceICalendarProvider
- Parameters:
units
- The unit of measurement. (Example: day, week, month, year )startDate
- The start date for the date range of events in this calendar provider.endDate
- The end date for the date range of events in this calendar provider.initialDate
- An initial start date within the date range of events in this calendar provider.numDisplayUnits
- The number of calendar units displays by the provider.
-
getStartDate
Description copied from interface:ICalendarProvider
Get the start date of the date range for this provider. Must return a valid Date.- Specified by:
getStartDate
in interfaceICalendarProvider
- Returns:
- The end date for the date range of this provider.
-
setStartDate
Description copied from interface:ICalendarProvider
Set the start date of the date range for this provider.- Specified by:
setStartDate
in interfaceICalendarProvider
-
getEndDate
Description copied from interface:ICalendarProvider
Get the end date of the date range for this provider. Must return a valid Date.- Specified by:
getEndDate
in interfaceICalendarProvider
- Returns:
- The end date for the date range of this provider.
-
setEndDate
Description copied from interface:ICalendarProvider
Set the end date for the date range for this provider- Specified by:
setEndDate
in interfaceICalendarProvider
-
getInitialDate
Description copied from interface:ICalendarProvider
Get the initial date to display. Use the start date if not set.- Specified by:
getInitialDate
in interfaceICalendarProvider
- Returns:
- The initial date this provider will display.
-
setInitialDate
Description copied from interface:ICalendarProvider
Set the initial date to display.- Specified by:
setInitialDate
in interfaceICalendarProvider
- Parameters:
initialDate
- The initial date this provider will display.
-
getUnits
Description copied from interface:ICalendarProvider
Get the calendar unit of measure for this provider. ( Example: day, week, month, year )- Specified by:
getUnits
in interfaceICalendarProvider
- Returns:
- The unit of measure.
- See Also:
-
DefaultCalendarProvider
-
setUnits
Description copied from interface:ICalendarProvider
Set the calendar unit of measure for this provider. ( Example: day, week, month, year )- Specified by:
setUnits
in interfaceICalendarProvider
- Parameters:
units
- The unit of measure.- See Also:
-
DefaultCalendarProvider
-
getNumUnits
public int getNumUnits()Description copied from interface:ICalendarProvider
Get the number of calendar units in this provider. For displaying multiple CalendarUnit's in day mode, the end date for each CalendarUnit will have to be set or calculated to display properly.- Specified by:
getNumUnits
in interfaceICalendarProvider
- Returns:
- The number of calendar units
- See Also:
-
setNumUnits
public void setNumUnits(int units) Description copied from interface:ICalendarProvider
Set the the number of calendar units- Specified by:
setNumUnits
in interfaceICalendarProvider
-
toString
Description copied from interface:IContentProvider
Returns string representation of content.- Specified by:
toString
in interfaceIContentProvider
- Overrides:
toString
in classObject
- Returns:
String
representation of the wrapped content
-
getDayCount
public int getDayCount()Description copied from interface:ICalendarProvider
Get the number of days within the current calendar unit.- Specified by:
getDayCount
in interfaceICalendarProvider
- Returns:
- The number of days, staring at one.
-
getUnitStartDate
get the first day date in the current unit row (e.g. first of month)- Specified by:
getUnitStartDate
in interfaceICalendarProvider
- Returns:
- The start date for the calendar unit.
-
getUnitEndDate
get the last day date in the current unit row (e.g. last of month)- Specified by:
getUnitEndDate
in interfaceICalendarProvider
- Returns:
- The end date for the calendar unit.
-
getPropertyKeys
Description copied from interface:IContentProvider
Returns list of properties supported by this content provider. Can returnObject[0]
, never null.- Specified by:
getPropertyKeys
in interfaceIContentProvider
- Returns:
- array of property keys which is typically of type
String
orInteger
-
getType
Description copied from interface:IContentProvider
Returns java type of the given property- Specified by:
getType
in interfaceIContentProvider
- Parameters:
propertyKey
- the property key of typeString
orInteger
- Returns:
- property java
Class
- Throws:
PropertyNotFoundException
- if property is not supported
-
getValue
Description copied from interface:IContentProvider
Returns value of the given property- Specified by:
getValue
in interfaceIContentProvider
- Parameters:
propertyKey
- the property key of typeString
orInteger
- Returns:
- value of the property, can be
null
- Throws:
PropertyNotFoundException
- if property is not supportedELException
-
hasProperty
Description copied from interface:IContentProvider
Checks if the given property is supported by this content provider- Specified by:
hasProperty
in interfaceIContentProvider
- Parameters:
propertyKey
- property key of typeString
orInteger
- Returns:
true
if property is supported
-
getRowCount
public int getRowCount()Description copied from interface:ITableContentProvider
Return the number of rows of data objects represented by this DataModel.Return -1, if the number of rows is unknown, or no wrappedData is available.
- Specified by:
getRowCount
in interfaceITableContentProvider
- Returns:
- how many rows between start date and end date based on display units return -1 if end date is null.
- See Also:
-
getRowIndex
public int getRowIndex()Description copied from interface:ITableContentProvider
Return the zero-relative index of the currently selected row.If we are not currently positioned on a row, or no wrappedData is available, return -1.
- Specified by:
getRowIndex
in interfaceITableContentProvider
- Returns:
- row index
- See Also:
-
isRowAvailable
public boolean isRowAvailable()Description copied from interface:ITableContentProvider
Return a flag indicating whether there is rowData available at the current rowIndex. If no wrappedData is available, return false.- Specified by:
isRowAvailable
in interfaceITableContentProvider
- Returns:
- the flag indicates whether the row is available. It's available if the date row is between the start and end dates.
- See Also:
-
isUnitAvailable
public boolean isUnitAvailable()- See Also:
-
setUnitIndex
public void setUnitIndex(int unitIndex) Description copied from interface:ICalendarProvider
Set the current aligned calendar unit index, expressed as the number of calendar units from the provider start date- Specified by:
setUnitIndex
in interfaceICalendarProvider
- Parameters:
unitIndex
- The index for the current calendar unit.- See Also:
-
setRowIndex
public void setRowIndex(int rowIndex) Set row index. Also reset the calendar unit member.- Specified by:
setRowIndex
in interfaceITableContentProvider
- See Also:
-
getRowVariable
Description copied from interface:ITableContentProvider
Returns row variable name.
If specified row variable can be used to access current row data for the provider internal needs, like sorting or addressing.
- Specified by:
getRowVariable
in interfaceITableContentProvider
- Returns:
- row variable name or null if not specified
- See Also:
-
getUnitVariable
Description copied from interface:ICalendarProvider
Get the name of the request variable that current CalendarUnit will be exposed as. Used in binding expressions.- Specified by:
getUnitVariable
in interfaceICalendarProvider
- Returns:
- The name of the provider variable.
-
getUnitCount
public int getUnitCount()Description copied from interface:ICalendarProvider
Get the number of calendar units in this provider.- Specified by:
getUnitCount
in interfaceICalendarProvider
- Returns:
- The number of calendar units.
-
setRowVariable
Description copied from interface:ITableContentProvider
Sets row variable name to use for accessing row specific data. For example, if the provider wrapps an array of a data objects with
id
property and the variable name isitem
, then the provider implementation can accessid
property of each record asitem.id
.This property should set only once at the provider initialization time
- Specified by:
setRowVariable
in interfaceITableContentProvider
-
setUnitVariable
Description copied from interface:ICalendarProvider
Set the name of the request variable that current Calendar Unit will be exposed as. Used in binding expressions.- Specified by:
setUnitVariable
in interfaceICalendarProvider
- Parameters:
var
- The name of the provider variable.
-
getCurrentDay
Description copied from interface:ICalendarProvider
Get the day at the current day index within the current calendar unit.- Specified by:
getCurrentDay
in interfaceICalendarProvider
- Returns:
- The current calendar day.
-
isDayAvailable
public boolean isDayAvailable()Description copied from interface:ICalendarProvider
Is the day selected by setDayIndex within the start and end dates of the current calendar unit.- Specified by:
isDayAvailable
in interfaceICalendarProvider
- Returns:
- True if between the start and end dates of the current calendar unit.
-
setDayIndex
public void setDayIndex(int dayIndex) Description copied from interface:ICalendarProvider
Set the index of the day within the current calendar unit.- Specified by:
setDayIndex
in interfaceICalendarProvider
- Parameters:
dayIndex
- The number of days, staring at one.
-
getCurrentRow
Returns current row. If no row is current, returns first row. If doesn't have first row, returns null.- Specified by:
getCurrentRow
in interfaceITableContentProvider
- Returns:
- current row object
- See Also:
-
getCurrentUnit
Description copied from interface:ICalendarProvider
Get the current aligned calendar unit index, expressed as the number of calendar units from the provider start date- Specified by:
getCurrentUnit
in interfaceICalendarProvider
- Returns:
- The current calendar unit.
- See Also:
-
calcIndexFromDate
-
calcUnitStartDate
-
calcDefaultStartDate
-