click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sander van Grieken (JIRA)" <>
Subject [jira] Commented: (CLK-744) Select control's setValue is not usable due to insufficient wrapping
Date Sun, 09 Jan 2011 09:41:58 GMT


Sander van Grieken commented on CLK-744:

Bob, may I propose to reopen this bug, perhaps changing priority to Wish or something?

Like Finn Bock said, if the underlying representation of the Iterable is not a List, the behaviour
changes. So we got 3 paths of adding items, of which the List Iterable is the strange one

- add (String/Option/OptionGroup)
- DataProvider non List Iterable (String/Option/OptionGroup)
- DataProvider List Iterable (Option/OptionGroup)

So it is not consistent.

I think allowing also Strings in the List case is a benefit, since it makes the ways of adding
options consistent, and a convenience, since many DataProvider examples in the javadoc directly
return the results from the backend call as Strings. It also conforms to the expected behaviour,
as a click newbie like myself :)

> Select control's setValue is not usable due to insufficient wrapping
> --------------------------------------------------------------------
>                 Key: CLK-744
>                 URL:
>             Project: Click
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 2.3.0-M1, 2.2.0
>            Reporter: Sander van Grieken
>         Attachments:
> 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. '')
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
> I have modified the render(HtmlStringBuffer buffer) method in 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

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

View raw message