You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by james o'brien <jo...@spinnphr.com> on 2009/05/06 23:18:56 UTC

radiochoice and propertymodel ignoring converter (wicket 1.3.5)

I have a custom converter registered for Boolean.class that converts "yes"
to Boolean(true) and "no" to Boolean(false).  When the RadioChoice loads the
converter is never called.


<code>

private static final List<String> IRREGULAR_HEARTBEAT =
Arrays.asList(newString[] {
"yes", "no" });

RadioChoice irregular = new RadioChoice("irregularHeartbeat",
newPropertyModel(bloodPressure,

"irregularHeartbeat"), IRREGULAR_HEARTBEAT).setSuffix(" ");


BloodPressure Object:


public Boolean isIrregularHeartbeat() {

return bloodPressure.isIrregularHeartbeat();

}

public void setIrregularHeartbeat(Boolean value) {

bloodPressure.setIrregularHeartbeat(value);

}

</code>

Thanks,
--jim

Re: radiochoice and propertymodel ignoring converter (wicket 1.3.5)

Posted by Igor Vaynberg <ig...@gmail.com>.
that kind of conversion should go into ichoicerenderer implementation.
the converter is used to convert between browser's "on"/"" values to
true and false.

this is the sig of the constructor from 1.4, hopefully generics will
clear up how this works for you

public RadioChoice(final String id, IModel<T> model, final List<?
extends T> choices, IChoiceRenderer<T> renderer)

in your case T is Boolean.

-igor

On Wed, May 6, 2009 at 2:18 PM, james o'brien <jo...@spinnphr.com> wrote:
> I have a custom converter registered for Boolean.class that converts "yes"
> to Boolean(true) and "no" to Boolean(false).  When the RadioChoice loads the
> converter is never called.
>
>
> <code>
>
> private static final List<String> IRREGULAR_HEARTBEAT =
> Arrays.asList(newString[] {
> "yes", "no" });
>
> RadioChoice irregular = new RadioChoice("irregularHeartbeat",
> newPropertyModel(bloodPressure,
>
> "irregularHeartbeat"), IRREGULAR_HEARTBEAT).setSuffix(" ");
>
>
> BloodPressure Object:
>
>
> public Boolean isIrregularHeartbeat() {
>
> return bloodPressure.isIrregularHeartbeat();
>
> }
>
> public void setIrregularHeartbeat(Boolean value) {
>
> bloodPressure.setIrregularHeartbeat(value);
>
> }
>
> </code>
>
> Thanks,
> --jim
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org