[richfaces-svn-commits] JBoss Rich Faces SVN: r6455 - trunk/ui/progressBAR/src/main/java/org/richfaces/component.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Feb 29 10:00:00 EST 2008


Author: andrei_exadel
Date: 2008-02-29 09:59:59 -0500 (Fri, 29 Feb 2008)
New Revision: 6455

Modified:
   trunk/ui/progressBAR/src/main/java/org/richfaces/component/UIProgressBar.java
Log:
the last changes in progress bar

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 14:58:41 UTC (rev 6454)
+++ trunk/ui/progressBAR/src/main/java/org/richfaces/component/UIProgressBar.java	2008-02-29 14:59:59 UTC (rev 6455)
@@ -49,11 +49,38 @@
 
     /** Percent param name */
     private static final String PERCENT_PARAM = "percent";
+    
+    /** Max value attribute name */
+    private static final String _maxValue = "maxValue";
+    
+    /** Min value attribute name */
+    private static final String _minValue = "minValue";
+    
+    /** Enabled attribute name */
+    private static final String _enabled = "enabled";
+    
+    /** Enabled attribute name */
+    private static final String _interval = "interval";
+    
+    /** Complete class attribute name */
+    private static final String _completeClass = "completeClass";
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.ajax4jsf.component.AjaxActionComponent#broadcast(javax.faces.event.FacesEvent)
+    /** Remain class attribute name */
+    private static final String _remainClass = "remainClass";
+
+    /** Style class attribute name */
+    private static final String _styleClass = "styleClass";
+    
+    /** Markup data key */
+    private static final String _markup = "markup";
+    
+    /** Context key */
+    private static final String _context = "context";
+
+    /** 
+     * Method performs broadcasting of jsf events to progress bar component
+     *
+     * @param event - Faces Event instance 
      */
     public void broadcast(FacesEvent event) throws AbortProcessingException {
 
@@ -83,7 +110,7 @@
 		ajaxContext
 			.setResponseData(getResponseData(value, facesContext));
 
-		Object reRender = this.getAttributes().get("reRender");
+		Object reRender = this.getAttributes().get(AjaxRendererUtils.AJAX_REGIONS_ATTRIBUTE);
 		Set ajaxRegions = AjaxRendererUtils.asSet(reRender);
 
 		if (ajaxRegions != null) {
@@ -114,26 +141,23 @@
 
 	Map<Object, Object> map = new HashMap<Object, Object>();
 	map.put(RendererUtils.HTML.value_ATTRIBUTE, value);
-	map.put("interval", this.getInterval());
+	map.put(_interval, this.getInterval());
 
 	if (this.getAttributes().get(RendererUtils.HTML.style_ATTRIBUTE) != null) {
 	    map.put(RendererUtils.HTML.style_ATTRIBUTE, this.getAttributes().get(RendererUtils.HTML.style_ATTRIBUTE));
 	}
 
-	boolean enabled = (Boolean) this.getAttributes().get("enabled");
-	map.put("enabled", Boolean.toString(enabled));
+	boolean enabled = (Boolean) this.getAttributes().get(_enabled);
+	map.put(_enabled, Boolean.toString(enabled));
 
 	if (!isSimple(renderer)) {
-	    map.put("markup", getMarkup(facesContext, renderer));
-	    map.put("context", getContext(renderer, value));
+	    map.put(_markup, getMarkup(facesContext, renderer));
+	    map.put(_context, getContext(renderer, value));
 	}
 
-	addStyles2Responce(map, "completeClass", this.getAttributes().get(
-		"completeClass"));
-	addStyles2Responce(map, "remainClass", this.getAttributes().get(
-		"remainClass"));
-	addStyles2Responce(map, "styleClass", this.getAttributes().get(
-		"styleClass"));
+	addStyles2Responce(map, _completeClass, this.getAttributes().get(_completeClass));
+	addStyles2Responce(map, _remainClass, this.getAttributes().get(_remainClass));
+	addStyles2Responce(map, _styleClass, this.getAttributes().get(_styleClass));
 	return map;
 
     }
@@ -148,16 +172,14 @@
     private JSLiteral getContext(AbstractProgressBarRenderer renderer,
 	    Number percent) {
 	StringBuffer buffer = new StringBuffer("{");
-	final String minValueAttr = "minValue";
-	final String maxValueAttr = "maxValue";
-	buffer.append("value:")
-		.append(ScriptUtils.toScript(percent.toString())).append(",");
-	buffer.append("minValue:").append(
-		ScriptUtils.toScript(this.getAttributes().get(minValueAttr)
-			.toString())).append(",");
-	buffer.append("maxValue:").append(
-		ScriptUtils.toScript(this.getAttributes().get(maxValueAttr)
-			.toString()));
+	buffer.append("value:");
+	buffer.append(ScriptUtils.toScript(percent.toString())).append(",");
+	buffer.append("minValue:");
+	buffer.append(ScriptUtils.toScript(this.getAttributes().get(_minValue)
+				.toString())).append(",");
+	buffer.append("maxValue:");
+	buffer.append(ScriptUtils.toScript(this.getAttributes().get(_maxValue)
+				.toString()));
 
 	String parameters = renderer.getParameters(this);
 	if (parameters != null) {
@@ -222,14 +244,14 @@
 	Number result = new Integer(0);
 	if (v != null) {
 	    try {
-		if (v instanceof String) {
+		if (v instanceof String) { // String 
 		    result = Double.parseDouble((String) v);
 		} else {
 		    Number n = (Number) v;
-		    if ((n instanceof BigDecimal) || (n instanceof Double)
+		    if ((n instanceof BigDecimal) || (n instanceof Double) // Double or BigDecimal
 			    || (n instanceof Float)) {
 			result = n.floatValue();
-		    } else if (n instanceof Integer) {
+		    } else if (n instanceof Integer) {                     // Integer
 			result = n.intValue();
 		    }
 		}




More information about the richfaces-svn-commits mailing list