You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mikko Pukki <Mi...@syncrontech.com> on 2009/05/06 12:21:17 UTC

ListMultipleChoice & AbstactChoice method&class access too strict?

Hi,

I have a case where ListMultipleChoice is on a page and model of
choices can change. To be more spesific, selected values can be moved
up and down on a list. When ListMultipleChoice is updated via Ajax,
selected items do not stay selected. I thought that overriding isSelected
on a ListMultipleChoice would be a viable option (not pretty though), because
I already have the selected objects cached elsewhere, so determing whether
or not an object is selected would be trivial.

But then I thought maybe I would be better to inherit a whole new implementation
from AbstractChoice. Well, it could be done, but the class has package access
to it, so no luck there. And if I override appendOptionHtml, it should be entirely
rewritten. And it uses private fields (renderer, and setter for that is again final...)
of AbstractChoice, so it makes things even more difficult.

Could it be possible to change access to the AbstractChoice (is package access at all necessary?)?
Or have I missed something obvious and maybe thinking this wrong way around? All I would
like to do, is set correct objects on list as selected, but I guess that there is no
any good way doing that.


------------------
Mikko Pukki
Syncron Tech Oy
Laserkatu 6
53850 Lappeenranta
+358 400 757 178



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


Re: ListMultipleChoice & AbstactChoice method&class access too strict?

Posted by Igor Vaynberg <ig...@gmail.com>.
i think a better solution would be to use ajaxsubmitbutton with
defaultformprocessing=false, that way the LMC will keep the selection
and its The Right Way to do it.

-igor

On Wed, May 6, 2009 at 3:21 AM, Mikko Pukki <Mi...@syncrontech.com> wrote:
> Hi,
>
> I have a case where ListMultipleChoice is on a page and model of
> choices can change. To be more spesific, selected values can be moved
> up and down on a list. When ListMultipleChoice is updated via Ajax,
> selected items do not stay selected. I thought that overriding isSelected
> on a ListMultipleChoice would be a viable option (not pretty though), because
> I already have the selected objects cached elsewhere, so determing whether
> or not an object is selected would be trivial.
>
> But then I thought maybe I would be better to inherit a whole new implementation
> from AbstractChoice. Well, it could be done, but the class has package access
> to it, so no luck there. And if I override appendOptionHtml, it should be entirely
> rewritten. And it uses private fields (renderer, and setter for that is again final...)
> of AbstractChoice, so it makes things even more difficult.
>
> Could it be possible to change access to the AbstractChoice (is package access at all necessary?)?
> Or have I missed something obvious and maybe thinking this wrong way around? All I would
> like to do, is set correct objects on list as selected, but I guess that there is no
> any good way doing that.
>
>
> ------------------
> Mikko Pukki
> Syncron Tech Oy
> Laserkatu 6
> 53850 Lappeenranta
> +358 400 757 178
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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