|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.pipeline.component.AbstractPipelineComponent org.apache.cocoon.sax.AbstractSAXPipelineComponent org.apache.cocoon.sax.AbstractSAXProducer org.apache.cocoon.sax.AbstractSAXGenerator org.apache.cocoon.optional.pipeline.components.sax.calendar.CalendarGenerator
public class CalendarGenerator
Generates an XML document representing a calendar for a given month and year.
Note for c3: Since this is a migration code the source is ATM only really usable
if you call setConfiguration(final Map
Here is a sample output:
The src parameter is ignored.
Configuration options:
<calendar:calendar xmlns:calendar="http://apache.org/cocoon/calendar/1.0"
year="2004" month="January" prevMonth="12" prevYear="2003"
nextMonth="02" nextYear="2004">
<calendar:week number="1">
<calendar:day number="1" weekday="THURSDAY" date="January 1, 2004"/>
<calendar:day number="2" weekday="FRIDAY" date="January 2, 2004"/>
<calendar:day number="3" weekday="SATURDAY" date="January 3, 2004"/>
<calendar:day number="4" weekday="SUNDAY" date="January 4, 2004"/>
</calendar:week>
...
</calendar:calendar>
Field Summary | |
---|---|
protected org.xml.sax.helpers.AttributesImpl |
attributes
Convenience object, so we don't need to create an AttributesImpl for every element. |
protected Parameters |
cacheKeyParList
The cache key needs to be generated for the configuration of this generator, so storing the parameters for generateKey(). |
protected static String |
CALENDAR_NODE_NAME
Node and attribute names |
protected static String |
DATE_ATTR_NAME
|
protected DateFormat |
dateFormatter
The format for dates |
protected static String |
DAY_NODE_NAME
|
protected Locale |
locale
The current locale |
protected int |
month
The month to generate the calendar for |
protected static String |
MONTH_ATTR_NAME
|
protected DateFormat |
monthFormatter
The format for month names |
protected static DecimalFormat |
monthNumberFormatter
Formatter for month number |
protected static String |
NEXT_MONTH_ATTR_NAME
|
protected static String |
NEXT_YEAR_ATTR_NAME
|
protected static String |
NUMBER_ATTR_NAME
|
protected boolean |
padWeeks
Do we need to pad out the first and last weeks? |
protected static String |
PREFIX
The namespace prefix for this namespace. |
protected static String |
PREV_MONTH_ATTR_NAME
|
protected static String |
PREV_YEAR_ATTR_NAME
|
protected static String |
URI
The URI of the namespace of this generator. |
protected static String |
WEEK_NODE_NAME
|
protected static String |
WEEKDAY_ATTR_NAME
|
protected String[] |
weekdays
|
protected int |
year
The year to generate the calendar for |
protected static String |
YEAR_ATTR_NAME
|
Constructor Summary | |
---|---|
CalendarGenerator()
|
Method Summary | |
---|---|
protected void |
addContent(Calendar date,
Locale locale)
Add content to a <day> element. |
CacheKey |
constructCacheKey()
|
void |
execute()
Generate XML data. |
void |
recycle()
Recycle resources |
void |
setConfiguration(Map<String,? extends Object> configuration)
Set the request parameters. |
Methods inherited from class org.apache.cocoon.sax.AbstractSAXProducer |
---|
getSAXConsumer, setConsumer, setSAXConsumer, toString |
Methods inherited from class org.apache.cocoon.pipeline.component.AbstractPipelineComponent |
---|
finish, setup |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.cocoon.pipeline.component.PipelineComponent |
---|
finish, setup |
Field Detail |
---|
protected static final String URI
protected static final String PREFIX
protected static final String CALENDAR_NODE_NAME
protected static final String WEEK_NODE_NAME
protected static final String DAY_NODE_NAME
protected static final String MONTH_ATTR_NAME
protected static final String YEAR_ATTR_NAME
protected static final String DATE_ATTR_NAME
protected static final String NUMBER_ATTR_NAME
protected static final String WEEKDAY_ATTR_NAME
protected static final String PREV_MONTH_ATTR_NAME
protected static final String PREV_YEAR_ATTR_NAME
protected static final String NEXT_MONTH_ATTR_NAME
protected static final String NEXT_YEAR_ATTR_NAME
protected static final DecimalFormat monthNumberFormatter
protected org.xml.sax.helpers.AttributesImpl attributes
protected Parameters cacheKeyParList
protected int year
protected int month
protected DateFormat dateFormatter
protected DateFormat monthFormatter
protected Locale locale
protected boolean padWeeks
protected String[] weekdays
Constructor Detail |
---|
public CalendarGenerator()
Method Detail |
---|
public void setConfiguration(Map<String,? extends Object> configuration)
setConfiguration
in interface PipelineComponent
setConfiguration
in class AbstractPipelineComponent
resolver
- the SourceResolver objectobjectModel
- a Map
containing model objectsrc
- the source URI (ignored)par
- configuration parameterspublic CacheKey constructCacheKey()
constructCacheKey
in interface CachingPipelineComponent
public void execute() throws ProcessingException
execute
in interface Starter
SAXException
- if an error occurs while outputting the document
ProcessingException
protected void addContent(Calendar date, Locale locale) throws SAXException
date
- The date corresponding to the current element.locale
- The current locale.
SAXException
- if an error occurs while outputting the documentpublic void recycle()
for traditional background history. Keeping it for handyniess
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |