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

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon Dec 15 08:11:20 EST 2008


Author: abelevich
Date: 2008-12-15 08:11:19 -0500 (Mon, 15 Dec 2008)
New Revision: 11771

Modified:
   trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java
Log:
https://jira.jboss.org/jira/browse/RF-5318

Modified: trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java
===================================================================
--- trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java	2008-12-15 13:06:51 UTC (rev 11770)
+++ trunk/ui/dataFilterSlider/src/main/java/org/richfaces/component/UIDataFltrSlider.java	2008-12-15 13:11:19 UTC (rev 11771)
@@ -80,8 +80,11 @@
             AjaxRendererUtils.addRegionByName(context, this, this.getId());
             String forAttr = this.getFor();
             RendererUtils rendUtil = RendererUtils.getInstance();
-            AjaxRendererUtils.addRegionByName(context, this, rendUtil.correctForIdReference(forAttr, this));
             
+            if(forAttr != null) {
+            	AjaxRendererUtils.addRegionByName(context, this, rendUtil.correctForIdReference(forAttr, this));
+            }	
+            
            if(getSliderListeners().length < 1){
                addSliderListener(new DataFilterSliderAdapter(getSliderListener()));
            }
@@ -213,39 +216,45 @@
 
         int segmentTotal;
         int segmentTotalStart;
+        
+        Integer startRange = getStartRange();
+        Integer endRange = getEndRange();
+        Integer increment = getIncrement();
 
-        if (getStartRange().intValue() == 0) {
-            segmentTotal = (getEndRange().intValue() / getIncrement().intValue());
-            //set slider start to 0
-            segmentTotalStart = 0;
-        } else {
-            //subtract 1 for 0 based array
-            segmentTotal = (getEndRange().intValue() / getIncrement().intValue()) - 1;
-            //set the slider start for the loop
-            segmentTotalStart = getStartRange().intValue();
+        if((startRange != null) && (endRange != null) && (increment != null)) {
+	        if (getStartRange().intValue() == 0) {
+	            segmentTotal = (getEndRange().intValue() / getIncrement().intValue());
+	            //set slider start to 0
+	            segmentTotalStart = 0;
+	        } else {
+	            //subtract 1 for 0 based array
+	            segmentTotal = (getEndRange().intValue() / getIncrement().intValue()) - 1;
+	            //set the slider start for the loop
+	            segmentTotalStart = getStartRange().intValue();
+	        }
+	        int j = segmentTotalStart;
+	
+	        for (int i = segmentTotalStart; i <= segmentTotal; i++) {
+	            if (i != 0) {
+	                //Check to see if we are at start of slider
+	                if (i != j){
+	                    //increment by number given
+	                    j = j + getIncrement().intValue();
+	                }
+	            } else {
+	                //start at specified range
+	                j = getStartRange().intValue();
+	            }
+	
+	            if (i == segmentTotal) {
+	                //this is the end so no comma and exact specified
+	                sliderValues = sliderValues + getEndRange();
+	            } else {
+	                //add to string
+	                sliderValues = sliderValues + j + ",";
+	            }
+	        }
         }
-        int j = segmentTotalStart;
-
-        for (int i = segmentTotalStart; i <= segmentTotal; i++) {
-            if (i != 0) {
-                //Check to see if we are at start of slider
-                if (i != j){
-                    //increment by number given
-                    j = j + getIncrement().intValue();
-                }
-            } else {
-                //start at specified range
-                j = getStartRange().intValue();
-            }
-
-            if (i == segmentTotal) {
-                //this is the end so no comma and exact specified
-                sliderValues = sliderValues + getEndRange();
-            } else {
-                //add to string
-                sliderValues = sliderValues + j + ",";
-            }
-        }
         return sliderValues;
     }
 




More information about the richfaces-svn-commits mailing list