public class DefaultCalendarProvider extends PageFlowScopeAdapter implements ICalendarProvider
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 dateModifier and Type | Field and Description |
---|---|
protected com.ibm.icu.util.Calendar |
m_calendar |
protected CalendarUnit |
m_calendarUnit |
protected int |
m_dayIndex |
protected String |
m_dayVar |
protected Date |
m_endDate |
protected boolean |
m_init |
protected Date |
m_initialDate |
protected Locale |
m_locale |
protected int |
m_numUnits |
protected Date |
m_startDate |
protected com.ibm.icu.util.TimeZone |
m_timeZone |
protected int |
m_unitIndex |
protected String |
m_units |
protected static long |
MS_IN_DAY |
static String |
UNIT_DAY |
static String |
UNIT_MONTH |
static String |
UNIT_WEEK |
static String |
UNIT_YEAR |
fExpireWithPageFlow
Constructor and Description |
---|
DefaultCalendarProvider()
Default 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.
|
Modifier and Type | Method and Description |
---|---|
protected Date |
calcDefaultStartDate() |
protected int |
calcIndexFromDate(Date date) |
protected Date |
calcUnitStartDate(Date date) |
ICalendarDay |
getCurrentDay()
Get the day at the current day index within the current calendar unit.
|
Object |
getCurrentRow()
Returns current row.
|
CalendarUnit |
getCurrentUnit()
Get the current aligned calendar unit index, expressed as the
number of calendar units from the provider start date
|
int |
getDayCount()
Get the number of days within the current calendar unit.
|
Date |
getEndDate()
Get the end date of the date range for this provider.
|
Date |
getInitialDate()
Get the initial date to display.
|
int |
getNumUnits()
Get the number of calendar units in this provider.
|
Object[] |
getPropertyKeys()
Returns list of properties supported by this content provider.
|
int |
getRowCount()
Return the number of rows of data objects represented by this DataModel.
|
int |
getRowIndex()
Return the zero-relative index of the currently selected row.
|
String |
getRowVariable()
Returns row variable name.
|
Date |
getStartDate()
Get the start date of the date range for this provider.
|
Class<?> |
getType(Object propertyKey)
Returns java type of the given property
|
int |
getUnitCount()
Get the number of calendar units in this provider.
|
Date |
getUnitEndDate()
get the last day date in the current unit row (e.g.
|
String |
getUnits()
Get the calendar unit of measure for this provider.
|
Date |
getUnitStartDate()
get the first day date in the current unit row (e.g.
|
String |
getUnitVariable()
Get the name of the request variable that current CalendarUnit will
be exposed as.
|
Object |
getValue(Object propertyKey)
Returns value of the given property
|
boolean |
hasProperty(Object propertyKey)
Checks if the given property is supported by this content provider
|
void |
initialize(String units,
Date startDate,
Date endDate,
Date initialDate,
int numDisplayUnits)
Common method to set the content of the calendar provider.
|
boolean |
isDayAvailable()
Is the day selected by setDayIndex within the start and end dates of the current calendar unit.
|
boolean |
isInitialized()
Determine if method initialize has been called.
|
boolean |
isRowAvailable()
Return a flag indicating whether there is rowData available at the
current rowIndex.
|
boolean |
isUnitAvailable() |
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 provider
|
void |
setInitialDate(Date initialDate)
Set the initial date to display.
|
void |
setNumUnits(int units)
Set the the number of calendar units
|
void |
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 date
|
void |
setUnits(String units)
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.
|
String |
toString()
Returns string representation of content.
|
getExpireWithPageFlow, setExpireWithPageFlow
protected boolean m_init
protected int m_unitIndex
protected int m_dayIndex
protected String m_units
protected Date m_startDate
protected Date m_endDate
protected Date m_initialDate
protected int m_numUnits
protected CalendarUnit m_calendarUnit
protected com.ibm.icu.util.Calendar m_calendar
protected Locale m_locale
protected com.ibm.icu.util.TimeZone m_timeZone
protected String m_dayVar
public static final String UNIT_DAY
public static final String UNIT_WEEK
public static final String UNIT_MONTH
public static final String UNIT_YEAR
protected static final long MS_IN_DAY
public DefaultCalendarProvider()
public DefaultCalendarProvider(Locale locale, com.ibm.icu.util.TimeZone timeZone)
locale
- timeZone
- public DefaultCalendarProvider(Date startDate, Locale locale, com.ibm.icu.util.TimeZone timeZone)
startDate
- locale
- timeZone
- public boolean isInitialized()
ICalendarProvider
isInitialized
in interface ICalendarProvider
public void initialize(String units, Date startDate, Date endDate, Date initialDate, int numDisplayUnits)
ICalendarProvider
initialize
in interface ICalendarProvider
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.public Date getStartDate()
ICalendarProvider
getStartDate
in interface ICalendarProvider
public void setStartDate(Date date)
ICalendarProvider
setStartDate
in interface ICalendarProvider
public Date getEndDate()
ICalendarProvider
getEndDate
in interface ICalendarProvider
public void setEndDate(Date date)
ICalendarProvider
setEndDate
in interface ICalendarProvider
public Date getInitialDate()
ICalendarProvider
getInitialDate
in interface ICalendarProvider
public void setInitialDate(Date initialDate)
ICalendarProvider
setInitialDate
in interface ICalendarProvider
initialDate
- The initial date this provider will display.public String getUnits()
ICalendarProvider
getUnits
in interface ICalendarProvider
DefaultCalendarProvider
public void setUnits(String units)
ICalendarProvider
setUnits
in interface ICalendarProvider
units
- The unit of measure.DefaultCalendarProvider
public int getNumUnits()
ICalendarProvider
getNumUnits
in interface ICalendarProvider
CalendarUnit
public void setNumUnits(int units)
ICalendarProvider
setNumUnits
in interface ICalendarProvider
public String toString()
IContentProvider
toString
in interface IContentProvider
toString
in class Object
String
representation of the wrapped contentpublic int getDayCount()
ICalendarProvider
getDayCount
in interface ICalendarProvider
public Date getUnitStartDate()
getUnitStartDate
in interface ICalendarProvider
public Date getUnitEndDate()
getUnitEndDate
in interface ICalendarProvider
public Object[] getPropertyKeys()
IContentProvider
Object[0]
,
never null.getPropertyKeys
in interface IContentProvider
String
or Integer
public Class<?> getType(Object propertyKey) throws PropertyNotFoundException
IContentProvider
getType
in interface IContentProvider
propertyKey
- the property key of type String
or Integer
Class
PropertyNotFoundException
- if property is not supportedpublic Object getValue(Object propertyKey) throws ELException, PropertyNotFoundException
IContentProvider
getValue
in interface IContentProvider
propertyKey
- the property key of type String
or Integer
null
PropertyNotFoundException
- if property is not supportedELException
public boolean hasProperty(Object propertyKey)
IContentProvider
hasProperty
in interface IContentProvider
propertyKey
- property key of type String
or Integer
true
if property is supportedpublic int getRowCount()
ITableContentProvider
Return -1, if the number of rows is unknown, or no wrappedData is available.
getRowCount
in interface ITableContentProvider
DataModel.getRowCount()
public int getRowIndex()
ITableContentProvider
If we are not currently positioned on a row, or no wrappedData is available, return -1.
getRowIndex
in interface ITableContentProvider
DataModel.getRowIndex()
public boolean isRowAvailable()
ITableContentProvider
isRowAvailable
in interface ITableContentProvider
DataModel.isRowAvailable()
public boolean isUnitAvailable()
isRowAvailable()
public void setUnitIndex(int unitIndex)
ICalendarProvider
setUnitIndex
in interface ICalendarProvider
unitIndex
- The index for the current calendar unit.setRowIndex(int)
public void setRowIndex(int rowIndex)
setRowIndex
in interface ITableContentProvider
DataModel.getRowIndex()
public String getRowVariable()
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.
getRowVariable
in interface ITableContentProvider
ITableContentProvider.setRowVariable(String)
public String getUnitVariable()
ICalendarProvider
getUnitVariable
in interface ICalendarProvider
public int getUnitCount()
ICalendarProvider
getUnitCount
in interface ICalendarProvider
public void setRowVariable(String var)
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 is item
, then
the provider implementation can access id
property of each
record as item.id
.
This property should set only once at the provider initialization time
setRowVariable
in interface ITableContentProvider
public void setUnitVariable(String var)
ICalendarProvider
setUnitVariable
in interface ICalendarProvider
var
- The name of the provider variable.public ICalendarDay getCurrentDay()
ICalendarProvider
getCurrentDay
in interface ICalendarProvider
public boolean isDayAvailable()
ICalendarProvider
isDayAvailable
in interface ICalendarProvider
public void setDayIndex(int dayIndex)
ICalendarProvider
setDayIndex
in interface ICalendarProvider
dayIndex
- The number of days, staring at one.public Object getCurrentRow()
getCurrentRow
in interface ITableContentProvider
ITableContentProvider.isRowAvailable()
public CalendarUnit getCurrentUnit()
ICalendarProvider
getCurrentUnit
in interface ICalendarProvider
CalendarUnit
protected int calcIndexFromDate(Date date)
protected Date calcDefaultStartDate()