Author: vbaranov
Date: 2008-03-26 06:59:00 -0400 (Wed, 26 Mar 2008)
New Revision: 7241
Modified:
branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
http://jira.jboss.com/jira/browse/RF-2757
Modified:
branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
---
branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-03-26
09:26:06 UTC (rev 7240)
+++
branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-03-26
10:59:00 UTC (rev 7241)
@@ -71,7 +71,12 @@
protected static final String WEEK_DAY_LABELS = "weekDayLabels";
- public static final String DATE_SCROLL = "DateScroll";
+ /**
+ * The constant used to resolve id of hidden input placed on the page
+ * for storing current date in "MM/yyyy" format.
+ * Actual id of hidden input used on the page is #{clientId}InputCurrentDate
+ */
+ public static final String CURRENT_DATE_INPUT = "InputCurrentDate";
protected static final String MARKUP_SUFFIX = "Markup";
@@ -139,12 +144,9 @@
Map requestParameterMap = context.getExternalContext()
.getRequestParameterMap();
- String currentDateString = (String) requestParameterMap.get(clientId
- + DATE_SCROLL);
+ String currentDateString = (String) requestParameterMap.get(clientId +
CURRENT_DATE_INPUT);
if (currentDateString != null) {
- // ((UICalendar) component)
- // .setCurrentDate(convertCurrentDate(currentDateString));
CurrentDateChangeEvent ev = new CurrentDateChangeEvent(component,
currentDateString);
ev.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
@@ -316,10 +318,7 @@
}
options.put("oncomplete", oncompleteDefinition);
- Map parametersMap = (Map) options.get("parameters");
JSReference requestValue = new JSReference("requestValue");
- parametersMap.remove(clientId);
- parametersMap.put(clientId + DATE_SCROLL, requestValue);
ajaxFunction.addParameter(options);
JSFunctionDefinition definition = new JSFunctionDefinition();
definition.addParameter(requestValue);
Modified:
branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
---
branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-03-26
09:26:06 UTC (rev 7240)
+++
branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-03-26
10:59:00 UTC (rev 7241)
@@ -1652,21 +1652,25 @@
if (this.getCurrentMonth()!=month || this.getCurrentYear()!=year)
{
var date = new Date(year, month,1);
- if (this.invokeEvent("currentdateselect", $(this.id), null, date))
- {
- this.currentDate = date;
- this.onUpdate();
- }
+ // fix for RF-2450.
+ // Wrong sequence: at first the hidden input with current date value
+ // should be updated in function onUpdate()
+ // and then the "currentdateselect" Event should be fired.
+ this.currentDate = date;
+ this.onUpdate();
+ this.invokeEvent("currentdateselect", $(this.id), null, date);
}
},
changeCurrentDateOffset: function(yearOffset, monthOffset) {
var date = new Date(this.currentDate.getFullYear()+yearOffset,
this.currentDate.getMonth()+monthOffset,1);
- if (this.invokeEvent("currentdateselect", $(this.id), null, date))
- {
- this.currentDate = date;
- this.onUpdate();
- }
+ // fix for RF-2450.
+ // Wrong sequence: at first the hidden input with current date value
+ // should be updated in function onUpdate()
+ // and then the "currentdateselect" Event should be fired.
+ this.currentDate = date;
+ this.onUpdate();
+ this.invokeEvent("currentdateselect", $(this.id), null, date);
},
today: function(noUpdate, noHighlight) {