Author: abelevich
Date: 2007-10-25 06:04:39 -0400 (Thu, 25 Oct 2007)
New Revision: 3521
Modified:
branches/3.1.x/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
Log:
RF-1145 (add getParameters method)
Modified:
branches/3.1.x/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
===================================================================
---
branches/3.1.x/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2007-10-25
09:45:56 UTC (rev 3520)
+++
branches/3.1.x/ui/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2007-10-25
10:04:39 UTC (rev 3521)
@@ -22,14 +22,19 @@
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;
+import org.ajax4jsf.Messages;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
@@ -248,6 +253,28 @@
return context.getExternalContext().getRequestParameterMap();
}
+ //get UIParameter's Map
+ protected Map getParameters(FacesContext context, 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;
+ String name = param.getName();
+ if (name != null) {
+ parameters.put(name, param.getValue());
+ }
+ }
+ }
+ }
+
+ return parameters;
+ }
+
public String getOnClick(FacesContext context, UIComponent component,
String value) {
@@ -258,6 +285,12 @@
component);
Map parameters = (Map) eventOptions.get("parameters");
parameters.put(scroller.getClientId(context), value);
+
+ Map params = getParameters(context,component);
+ if(!params.isEmpty()){
+ parameters.putAll(params);
+ }
+
function.addParameter(eventOptions);
StringBuffer buffer = new StringBuffer();
function.appendScript(buffer);
Show replies by date