click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From take...@apache.org
Subject svn commit: r746660 - /incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java
Date Sun, 22 Feb 2009 11:45:27 GMT
Author: takezoe
Date: Sun Feb 22 11:45:27 2009
New Revision: 746660

URL: http://svn.apache.org/viewvc?rev=746660&view=rev
Log:
[CLK-490]Override PickList#getValueObject to set a list of selected values.

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

Modified: incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java?rev=746660&r1=746659&r2=746660&view=diff
==============================================================================
--- incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java (original)
+++ incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java Sun
Feb 22 11:45:27 2009
@@ -471,6 +471,24 @@
     public Object getValueObject() {
         return getSelectedValues();
     }
+    
+    /**
+     * Set the value the value must be a List of String.
+     *
+     * @see org.apache.click.control.Field#setValueObject(java.lang.Object)
+     *
+     * @param object a List or null
+     */
+    public void setValueObject(Object object) {
+        if (object instanceof List) {
+            getSelectedValues().clear();
+            
+            List list = (List) object;
+            for (int i = 0; i < list.size(); i++) {
+                addSelectedValue((String) list.get(i));
+            }
+        }
+    }
 
     /**
      * Set the component size.



Mime
View raw message