Author: abelevich
Date: 2007-10-23 05:57:27 -0400 (Tue, 23 Oct 2007)
New Revision: 3481
Modified:
trunk/ui/datascroller/src/main/config/component/datascroller.xml
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
Log:
fix RF-1145 (add encode params method)
Modified: trunk/ui/datascroller/src/main/config/component/datascroller.xml
===================================================================
--- trunk/ui/datascroller/src/main/config/component/datascroller.xml 2007-10-23 09:23:07
UTC (rev 3480)
+++ trunk/ui/datascroller/src/main/config/component/datascroller.xml 2007-10-23 09:57:27
UTC (rev 3481)
@@ -79,7 +79,6 @@
<property>
<name>scrollerListener</name>
- <classname>javax.faces.el.MethodBinding</classname>
<description>MethodBinding representing an action listener method that will be
notified after scrolling
</description>
</property>
Modified: trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
===================================================================
---
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2007-10-23
09:23:07 UTC (rev 3480)
+++
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2007-10-23
09:57:27 UTC (rev 3481)
@@ -27,12 +27,12 @@
import org.richfaces.event.DataScrollerListener;
import org.richfaces.event.DataScrollerSource;
+import javax.el.MethodExpression;
import javax.faces.FacesException;
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
import javax.faces.component.UIData;
import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
@@ -100,16 +100,16 @@
setupReRender(context);
- MethodBinding scrollerListener = getScrollerListener();
+ MethodExpression scrollerListener = getScrollerListener();
if (scrollerListener != null) {
- scrollerListener.invoke(context, new Object[]{event});
+ scrollerListener.invoke(context.getELContext(), new Object[]{event});
}
}
}
- public abstract MethodBinding getScrollerListener();
+ public abstract MethodExpression getScrollerListener();
- public abstract void setScrollerListener(MethodBinding scrollerListener);
+ public abstract void setScrollerListener(MethodExpression scrollerListener);
public abstract void setFor(String f);
Modified:
trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
===================================================================
---
trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2007-10-23
09:23:07 UTC (rev 3480)
+++
trunk/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2007-10-23
09:57:27 UTC (rev 3481)
@@ -22,10 +22,14 @@
package org.richfaces.renderkit.html;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.component.UIData;
+import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.PhaseId;
@@ -248,6 +252,24 @@
return context.getExternalContext().getRequestParameterMap();
}
+ protected Map getParameters(UIComponent component){
+ Map parameters = new HashMap();
+
+ if(component instanceof UIDatascroller){
+ UIDatascroller datascroller = (UIDatascroller)component;
+ List children = datascroller.getChildren();
+ for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ UIComponent child = (UIComponent) iterator.next();
+ if(child instanceof UIParameter) {
+ UIParameter param = (UIParameter)child;
+ parameters.put(param.getName(), param.getValue());
+ }
+ }
+ }
+
+ return parameters;
+ }
+
public String getOnClick(FacesContext context, UIComponent component,
String value) {
@@ -258,6 +280,12 @@
component);
Map parameters = (Map) eventOptions.get("parameters");
parameters.put(scroller.getClientId(context), value);
+
+ Map params = getParameters(component);
+ if(!params.isEmpty()){
+ parameters.putAll(params);
+ }
+
function.addParameter(eventOptions);
StringBuffer buffer = new StringBuffer();
function.appendScript(buffer);