[ 
https://issues.apache.org/jira/browse/CLK-744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980035#action_12980035
 ] 

Bob Schellink commented on CLK-744:
-----------------------------------

Another thing to keep in mind is with Options, we can just use the DP list as 
is. If we accpt Strings we have to iterate it to convert to Options. I don't 
want my apps to pay this price if I am doing the right thing and defining 
Options.

I think we should monitor the user list and if people complain we can revisit 
this issue.

> Select control's setValue is not usable due to insufficient wrapping
> --------------------------------------------------------------------
>
>                 Key: CLK-744
>                 URL: https://issues.apache.org/jira/browse/CLK-744
>             Project: Click
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 2.3.0-M1, 2.2.0
>            Reporter: Sander van Grieken
>         Attachments: SelectTestPage.java
>
>
> When calling setValue on a Select instance, it bombs out while rendering, 
> regardless whether a String or an Option is passed.
> Passing an Option instance causes it to be 'toString'-ed as an Object (i.e. 
> 'org.apache.click.control.opt...@1c154a3') when retrieving the selected value 
> again.
> Passing a String causes it to throw a java.lang.IllegalArgumentException: 
> Select option class not instance of Option or OptionGroup: java.lang.String
> at org.apache.click.control.Select.render(Select.java:998)
> I have modified the render(HtmlStringBuffer buffer) method in Select.java to 
> additionally check for String instances, and in that case wrap it into an 
> Option, and that works fine.
>                 if (object instanceof String) {
>                       Option option = new Option(object);
>                       option.render(this, buffer);
>                 } else ...
> The setValue method should probably be overridden from Field to also support 
> the Option case

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to