Author: vbaranov
Date: 2008-03-17 12:05:23 -0400 (Mon, 17 Mar 2008)
New Revision: 6869
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
http://jira.jboss.com/jira/browse/RF-2450
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
---
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-03-17
16:04:35 UTC (rev 6868)
+++
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-03-17
16:05:23 UTC (rev 6869)
@@ -69,7 +69,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";
@@ -131,15 +136,12 @@
String clientId = component.getClientId(context);
- Map requestParameterMap = context.getExternalContext()
+ Map<String, String> 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);
@@ -310,10 +312,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:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
---
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-03-17
16:04:35 UTC (rev 6868)
+++
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-03-17
16:05:23 UTC (rev 6869)
@@ -1740,21 +1740,26 @@
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) {