cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robbypelss...@apache.org
Subject svn commit: r1414667 - /cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/calendar/CalendarGenerator.java
Date Wed, 28 Nov 2012 13:26:01 GMT
Author: robbypelssers
Date: Wed Nov 28 13:26:00 2012
New Revision: 1414667

URL: http://svn.apache.org/viewvc?rev=1414667&view=rev
Log:
[COCOON3-114]  bugfix

<calendar:calendar>  @prevYear="2010"  @nextYear="2012"  were not set correctly

Modified:
    cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/calendar/CalendarGenerator.java

Modified: cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/calendar/CalendarGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/calendar/CalendarGenerator.java?rev=1414667&r1=1414666&r2=1414667&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/calendar/CalendarGenerator.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/calendar/CalendarGenerator.java
Wed Nov 28 13:26:00 2012
@@ -156,18 +156,7 @@ public class CalendarGenerator extends A
     protected String weekdays[] = { "", "SUNDAY", "MONDAY", "TUESDAY",
             "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY" };
 
-    /**
-     * Set the request parameters. Must be called before the generate method.
-     * 
-     * @param resolver
-     *            the SourceResolver object
-     * @param objectModel
-     *            a <code>Map</code> containing model object
-     * @param src
-     *            the source URI (ignored)
-     * @param par
-     *            configuration parameters
-     */
+
     @Override
     public void setConfiguration(
             final Map<String, ? extends Object> configuration) {
@@ -223,6 +212,13 @@ public class CalendarGenerator extends A
         // Determine previous and next months
         Calendar prevMonth = (Calendar) start.clone();
         prevMonth.add(Calendar.MONTH, -1);
+     
+     	// Determine previous year and next year
+        Calendar prevYear = (Calendar) start.clone();
+        prevYear.add(Calendar.YEAR, -1);
+        Calendar nextYear = (Calendar) start.clone();
+        nextYear.add(Calendar.YEAR, 1);
+        
         try {
             this.getSAXConsumer().startDocument();
             this.getSAXConsumer().startPrefixMapping(PREFIX, URI);
@@ -235,13 +231,13 @@ public class CalendarGenerator extends A
             // Add previous and next month
             attributes.addAttribute("", PREV_YEAR_ATTR_NAME,
                     PREV_YEAR_ATTR_NAME, "CDATA",
-                    String.valueOf(prevMonth.get(Calendar.YEAR)));
+                    String.valueOf(prevYear.get(Calendar.YEAR)));
             attributes.addAttribute("", PREV_MONTH_ATTR_NAME,
                     PREV_MONTH_ATTR_NAME, "CDATA", monthNumberFormatter
                             .format(prevMonth.get(Calendar.MONTH) + 1));
             attributes.addAttribute("", NEXT_YEAR_ATTR_NAME,
                     NEXT_YEAR_ATTR_NAME, "CDATA",
-                    String.valueOf(end.get(Calendar.YEAR)));
+                    String.valueOf(nextYear.get(Calendar.YEAR)));
             attributes.addAttribute("", NEXT_MONTH_ATTR_NAME,
                     NEXT_MONTH_ATTR_NAME, "CDATA",
                     monthNumberFormatter.format(end.get(Calendar.MONTH) + 1));
@@ -372,4 +368,4 @@ public class CalendarGenerator extends A
         this.monthFormatter = null;
         this.locale = null;
     }
-}
\ No newline at end of file
+}



Mime
View raw message