either make 'sites' final or use Wicket events (
http://www.wicket-library.com/wicket-examples/events/ )

On Fri, Jun 15, 2012 at 12:42 PM, Dmitriy Neretin
<[email protected]> wrote:
> Thanks! It was really helpful! But I am only to 99% ready :)
>
> There is a little problem in your code example:
>
> if I make so:
> label.setDefaultModelObject(sites.getModelObject());
>
> I get a compiler error: "Cannot refer to a non-final variable sites inside
> an inner class..." Is there any workaround for this?
>
> Thank you!
>
>
> 2012/6/15 Martin Grigorov <[email protected]>
>
>> Something like:
>>
>> final Label label = ...
>> RadioChoice<String> sites = new RadioChoice<String>("site", SITES);
>>                sites.add(new AjaxFormChoiceComponentUpdatingBehavior()
>>                {
>>                        @Override
>>                        protected void onUpdate(AjaxRequestTarget target)
>>                        {
>>
>> label.setDefaultModelObject(sites.getModelObject());
>>                                target.add(label);
>>                        }
>>                });
>>
>> On Fri, Jun 15, 2012 at 11:25 AM, Dmitriy Neretin
>> <[email protected]> wrote:
>> > Thanks!
>> >
>> > Can you describe how can I use the
>> AjaxFormChoiceComponentUpdatingBehavior()
>> > with the label?
>> >
>> > 2012/6/15 Martin Grigorov <[email protected]>
>> >
>> >> Hi,
>> >>
>> >> #onSelectionChanged() works only if you override
>> >> #wantOnSelectionChanged() to return true.
>> >> Otherwise you can also use AjaxFormChoiceComponentUpdatingBehavior()
>> >> and update the label with Ajax.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [email protected]
>> >> For additional commands, e-mail: [email protected]
>> >>
>> >>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to