click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r1030948 - in /click/trunk/click/framework: src/org/apache/click/control/Select.java test/org/apache/click/control/SelectTest.java
Date Thu, 04 Nov 2010 13:26:00 GMT
Author: sabob
Date: Thu Nov  4 13:26:00 2010
New Revision: 1030948

URL: http://svn.apache.org/viewvc?rev=1030948&view=rev
Log:
Select setState should use a variable length List

Modified:
    click/trunk/click/framework/src/org/apache/click/control/Select.java
    click/trunk/click/framework/test/org/apache/click/control/SelectTest.java

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=1030948&r1=1030947&r2=1030948&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 Thu Nov  4 13:26:00
2010
@@ -974,7 +974,9 @@ public class Select extends Field {
             localSelectedState.add(selectState);
         } else {
             String[] selectState = (String[]) state;
-            localSelectedState = Arrays.asList(selectState);
+            for (String val : selectState) {
+            localSelectedState.add(val);
+        }
         }
         setSelectedValues(localSelectedState);
     }

Modified: click/trunk/click/framework/test/org/apache/click/control/SelectTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/control/SelectTest.java?rev=1030948&r1=1030947&r2=1030948&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/control/SelectTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/control/SelectTest.java Thu Nov  4 13:26:00
2010
@@ -119,6 +119,10 @@ public class SelectTest extends TestCase
         // Perform tests
         assertEquals(expectedState, select.getValue());
         assertEquals(expectedState, select.getSelectedValues().get(0));
+
+        // Make sure we can still add values to the Select after state is
+        // restored
+        select.getSelectedValues().add("male");
     }
 
     /**
@@ -140,5 +144,9 @@ public class SelectTest extends TestCase
         // Perform tests
         assertEquals(expectedState[0], select.getValue());
         assertTrue(Arrays.equals(expectedState, select.getSelectedValues().toArray()));
+
+        // Make sure we can still add values to the Select after state is
+        // restored
+        select.getSelectedValues().add("male");
     }
 }



Mime
View raw message