click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r965027 - in /click/trunk/click: extras/src/org/apache/click/extras/control/PickList.java framework/src/org/apache/click/control/Select.java
Date Sat, 17 Jul 2010 07:58:10 GMT
Author: sabob
Date: Sat Jul 17 07:58:09 2010
New Revision: 965027

URL: http://svn.apache.org/viewvc?rev=965027&view=rev
Log:
cleanup

Modified:
    click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java
    click/trunk/click/framework/src/org/apache/click/control/Select.java

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java?rev=965027&r1=965026&r2=965027&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java Sat Jul 17
07:58:09 2010
@@ -773,16 +773,18 @@ public class PickList extends Field {
     public void bindRequestValue() {
 
         // Load the selected items.
-        this.selectedValues = new ArrayList<String>();
+        List localSelectedValues = new ArrayList<String>();
 
-        String[] values =
+        String[] parameterValues =
             getContext().getRequest().getParameterValues(getName());
 
-        if (values != null) {
-            for (int i = 0; i < values.length; i++) {
-                selectedValues.add(values[i]);
+        if (parameterValues != null) {
+            for (String parameterValue : parameterValues) {
+                localSelectedValues.add(parameterValue);
             }
         }
+
+        setSelectedValues(localSelectedValues);
     }
 
     /**
@@ -820,14 +822,14 @@ public class PickList extends Field {
      */
     @Override
     public void render(HtmlStringBuffer buffer) {
-        List<Option> optionList      = getOptionList();
-        List<String> selectedValues  = getSelectedValues();
+        List<Option> localOptionList      = getOptionList();
+        List<String> localSelectedValues  = getSelectedValues();
         List<Map<String, Object>> options = new ArrayList<Map<String, Object>>();
 
-        for (Option option : optionList) {
+        for (Option option : localOptionList) {
             Map<String, Object> map = new HashMap<String, Object>();
             map.put("option", option);
-            map.put("selected", new Boolean(selectedValues.contains(option.getValue())));
+            map.put("selected", localSelectedValues.contains(option.getValue()));
             options.add(map);
         }
 
@@ -869,12 +871,12 @@ public class PickList extends Field {
         model.put("unselectedLabel", unselectedLabel);
         model.put("format", new Format());
         if (getSize() != 0) {
-            model.put("size", new Integer(getSize()));
+            model.put("size", getSize());
         }
-        model.put("height", new Integer(getHeight()));
-        model.put("valid", new Boolean(isValid()));
-        model.put("disabled", new Boolean(isDisabled()));
-        model.put("readOnly", new Boolean(isReadonly()));
+        model.put("height", getHeight());
+        model.put("valid", isValid());
+        model.put("disabled", isDisabled());
+        model.put("readOnly", isReadonly());
 
         renderTemplate(buffer, model);
     }

Modified: click/trunk/click/framework/src/org/apache/click/control/Select.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/Select.java?rev=965027&r1=965026&r2=965027&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/Select.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/Select.java Sat Jul 17 07:58:09
2010
@@ -905,27 +905,29 @@ public class Select extends Field {
     @Override
     public void bindRequestValue() {
 
-        selectedValues = new ArrayList<String>(5);
+        List localSelectedValues = new ArrayList<String>(5);
 
         // Process single item select case.
         if (!isMultiple()) {
             // Load the selected item.
             value = getContext().getRequestParameter(getName());
-            selectedValues.add(value);
+            localSelectedValues.add(value);
 
         // Process the multiple item select case.
         } else {
 
             // Load the selected items.
-            String[] values =
+            String[] parameterValues =
                 getContext().getRequest().getParameterValues(getName());
 
-            if (values != null) {
-                for (int i = 0; i < values.length; i++) {
-                    selectedValues.add(values[i]);
+            if (parameterValues != null) {
+                for (String parameterValue : parameterValues) {
+                    localSelectedValues.add(parameterValue);
                 }
             }
         }
+
+        setSelectedValues(localSelectedValues);
     }
 
     /**



Mime
View raw message