Author: andrei_exadel
Date: 2008-02-29 05:35:27 -0500 (Fri, 29 Feb 2008)
New Revision: 6439
Modified:
trunk/ui/progressBAR/src/main/java/org/richfaces/component/UIProgressBar.java
trunk/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
Log:
RF-2342
Modified: trunk/ui/progressBAR/src/main/java/org/richfaces/component/UIProgressBar.java
===================================================================
---
trunk/ui/progressBAR/src/main/java/org/richfaces/component/UIProgressBar.java 2008-02-29
10:08:20 UTC (rev 6438)
+++
trunk/ui/progressBAR/src/main/java/org/richfaces/component/UIProgressBar.java 2008-02-29
10:35:27 UTC (rev 6439)
@@ -39,36 +39,41 @@
public static final String COMPONENT_TYPE = "org.richfaces.ProgressBar";
public static final String COMPONENT_FAMILY = "org.richfaces.ProgressBar";
-
+
/** Request parameter name containing component state to render */
public static final String FORCE_PERCENT_PARAM = "forcePercent";
-
- private static final String PERCENT_PARAM = "percent";
-
- /* (non-Javadoc)
+ private static final String PERCENT_PARAM = "percent";
+
+ /*
+ * (non-Javadoc)
+ *
* @see
org.ajax4jsf.component.AjaxActionComponent#broadcast(javax.faces.event.FacesEvent)
*/
public void broadcast(FacesEvent event) throws AbortProcessingException {
+
if (event instanceof AjaxEvent) {
FacesContext facesContext = FacesContext.getCurrentInstance();
AjaxContext ajaxContext = AjaxContextImpl
.getCurrentInstance(facesContext);
-
HttpServletRequest request = (HttpServletRequest) facesContext
.getExternalContext().getRequest();
Map params = request.getParameterMap();
- if (!params.containsKey(FORCE_PERCENT_PARAM)
+ String clientId = this.getClientId(facesContext);
+
+ if (!params.containsKey(clientId)) {
+ return;
+ }
+
+ if (!params.containsKey(FORCE_PERCENT_PARAM)
&& params.containsKey(PERCENT_PARAM)) {
- Number value = getNumber(this.getAttributes().get("value"));
- ajaxContext.removeRenderedArea(this.getClientId(facesContext));
- ajaxContext.setResponseData(getResponseData(value,
- facesContext));
+ Number value = getNumber(this.getAttributes().get("value"));
+ ajaxContext.removeRenderedArea(clientId);
+ ajaxContext
+ .setResponseData(getResponseData(value, facesContext));
- Object reRender = this.getAttributes().get(
- "reRender");
- Set ajaxRegions = AjaxRendererUtils
- .asSet(reRender);
+ Object reRender = this.getAttributes().get("reRender");
+ Set ajaxRegions = AjaxRendererUtils.asSet(reRender);
if (ajaxRegions != null) {
for (Iterator iter = ajaxRegions.iterator(); iter.hasNext();) {
@@ -82,7 +87,7 @@
}
}
-
+
/**
* Returns ajax response data
*
@@ -124,6 +129,7 @@
/**
* Returns context for macrosubstitution
+ *
* @param renderer
* @param percent
* @return
@@ -131,10 +137,14 @@
private JSLiteral getContext(AbstractProgressBarRenderer renderer,
Number percent) {
StringBuffer buffer = new StringBuffer("{");
- buffer.append("value:").append(ScriptUtils.toScript(percent.toString())).append(",");
- buffer.append("minValue:").append(ScriptUtils.toScript(this.getAttributes().get("minValue").toString()))
- .append(",");
- buffer.append("maxValue:").append(ScriptUtils.toScript(this.getAttributes().get("maxValue").toString()));
+ buffer.append("value:")
+ .append(ScriptUtils.toScript(percent.toString())).append(",");
+ buffer.append("minValue:").append(
+ ScriptUtils.toScript(this.getAttributes().get("minValue")
+ .toString())).append(",");
+ buffer.append("maxValue:").append(
+ ScriptUtils.toScript(this.getAttributes().get("maxValue")
+ .toString()));
String parameters = renderer.getParameters(this);
if (parameters != null) {
@@ -144,9 +154,10 @@
buffer.append("}");
return new JSLiteral(buffer.toString());
}
-
+
/**
* Return true if markup is simple
+ *
* @return
*/
private boolean isSimple(AbstractProgressBarRenderer renderer) {
@@ -154,7 +165,8 @@
}
/**
- * Returns label markup
+ * Returns label markup
+ *
* @param context
* @param renderer
* @return
Modified:
trunk/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
===================================================================
---
trunk/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-02-29
10:08:20 UTC (rev 6438)
+++
trunk/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-02-29
10:35:27 UTC (rev 6439)
@@ -16,6 +16,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import javax.faces.event.ActionEvent;
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
import javax.servlet.http.HttpServletRequest;
@@ -280,6 +281,7 @@
}
Map parameters = (Map) options.get("parameters");
parameters.put("percent", "percent");
+ parameters.put(clientId, clientId);
// options.put("onbeforedomupdate", getOnComplete(clientId, progressBar,
// context));
return options;
Show replies by date