Author: ivaynberg
Date: Mon Jun 18 09:23:12 2007
New Revision: 548393

URL: http://svn.apache.org/viewvc?view=rev&rev=548393
Log:
WICKET-348, align with single choice refactor

Modified:
    
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/ListMultipleChoice.java

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/ListMultipleChoice.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/ListMultipleChoice.java?view=diff&rev=548393&r1=548392&r2=548393
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/ListMultipleChoice.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/ListMultipleChoice.java
 Mon Jun 18 09:23:12 2007
@@ -78,7 +78,8 @@
        }
 
        /**
-        * @see 
org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String, List)
+        * @see 
org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String,
+        *      List)
         */
        public ListMultipleChoice(final String id, final List choices)
        {
@@ -94,7 +95,8 @@
         *            list of choices
         * @param maxRows
         *            the maximum number of visible rows.
-        * @see 
org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String, List)
+        * @see 
org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String,
+        *      List)
         */
        public ListMultipleChoice(final String id, final List choices, final 
int maxRows)
        {
@@ -251,6 +253,27 @@
         */
        protected Object convertValue(String[] ids) throws ConversionException
        {
+               if (ids != null && ids.length > 0 && !Strings.isEmpty(ids[0]))
+               {
+                       return convertChoiceIdsToChoices(ids);
+               }
+               else
+               {
+                       // TODO 1.3: check if its safe to return 
Collections.EMPTY_LIST here
+                       return new ArrayList();
+               }
+       }
+
+       /**
+        * Converts submitted choice ids to choice objects.
+        * 
+        * @param ids
+        *            choice ids. this array is nonnull and always contains at 
least
+        *            one id.
+        * @return list of choices.
+        */
+       protected List convertChoiceIdsToChoices(String[] ids)
+       {
                ArrayList selectedValues = new ArrayList();
 
                // If one or more ids is selected
@@ -275,6 +298,7 @@
                        }
                }
                return selectedValues;
+
        }
 
        /**


Reply via email to