You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by cosmindumy <co...@yahoo.com> on 2012/07/23 15:53:19 UTC

getChoices from ListMultipleChoice

Hi,
I'm trying to get the selected options from a ListMultipleChoice but didn't
find a method to get a collection of selected options. 
I'm using the getValue method that return a String of choices separated by ;
but I'm sure is not right. 
What method should I use? 
Thanks. 



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/getChoices-from-ListMultipleChoice-tp4650725.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: getChoices from ListMultipleChoice

Posted by Igor Vaynberg <ig...@gmail.com>.
:/

-igor

On Mon, Jul 23, 2012 at 4:56 PM, Martin Grigorov <mg...@apache.org> wrote:
> getModel(Object)
>
> On Mon, Jul 23, 2012 at 4:53 PM, cosmindumy <co...@yahoo.com> wrote:
>> Hi,
>> I'm trying to get the selected options from a ListMultipleChoice but didn't
>> find a method to get a collection of selected options.
>> I'm using the getValue method that return a String of choices separated by ;
>> but I'm sure is not right.
>> What method should I use?
>> Thanks.
>>
>>
>>
>> --
>> View this message in context: http://apache-wicket.1842946.n4.nabble.com/getChoices-from-ListMultipleChoice-tp4650725.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> 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


Re: getChoices from ListMultipleChoice

Posted by cosmindumy <co...@yahoo.com>.
Hi again,
Sorry. I forgot to say that I tried this and I get null. 
I thing we change something in our framework and the wicket doesn't handle
properly the multiple choice. 
Does anyone has an idea what can be? 



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/getChoices-from-ListMultipleChoice-tp4650725p4650730.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: getChoices from ListMultipleChoice

Posted by Martin Grigorov <mg...@apache.org>.
getModel(Object)

On Mon, Jul 23, 2012 at 4:53 PM, cosmindumy <co...@yahoo.com> wrote:
> Hi,
> I'm trying to get the selected options from a ListMultipleChoice but didn't
> find a method to get a collection of selected options.
> I'm using the getValue method that return a String of choices separated by ;
> but I'm sure is not right.
> What method should I use?
> Thanks.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/getChoices-from-ListMultipleChoice-tp4650725.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



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

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


Re: getChoices from ListMultipleChoice

Posted by cosmindumy <co...@yahoo.com>.
Thanks
It helped me. But just another problem. 
I have a customized multiple choice with 2 multiple ListMultipleChoice
inside. and movieng selected choices from each other. 

I have problems with safe cast. 

Here is my class definition: 
public class CusomizedMultipleChoice<T> extends Panel 

Here are the two method I used.

Collection<T> leftChoices = leftChoice.getChoices();
Collection<T> selectedLeftChoices = leftChoice.getModelObject();

The compiler complains at first method. getChoices. Shouldn't return return
a collection of T.  compiler ask me to cast at Collection<T>. Is it safe to
do this?
I checked the wicket sources but couldn't find the cause. 
Is anything wrong?
Thanks. 




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/getChoices-from-ListMultipleChoice-tp4650725p4650789.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: getChoices from ListMultipleChoice

Posted by cosmindumy <co...@yahoo.com>.
Thanks
It helped me. But just another problem.
I have a customized multiple choice with 2 multiple ListMultipleChoice
inside. and movieng selected choices from each other. 
I have problems with safe cast.

Here is my class definition:
public class CusomizedMultipleChoice<T> extends Panel

Here are the two method I used.

Collection<T> leftChoices = leftChoice.getChoices();
Collection<T> selectedLeftChoices = leftChoice.getModelObject();

The compiler complains at first method. getChoices. Shouldn't return return
a collection of T.  compiler ask me to cast at Collection<T>. Is it safe to
do this?
I checked the wicket sources but couldn't find the cause.
Is anything wrong?
Thanks. 



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/getChoices-from-ListMultipleChoice-tp4650725p4650790.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: getChoices from ListMultipleChoice

Posted by Igor Vaynberg <ig...@gmail.com>.
AjaxLink does not submit the form. use AjaxButton instead.

also, you need to give the dropdownchoice a model (somewhere to store
the value)...see form examples.

-igor

On Tue, Jul 24, 2012 at 9:20 AM, cosmindumy <co...@yahoo.com> wrote:
> Hi,
> Just tried at home and still get null on getModelObject().
> Here is the complete code:
> http://shorttext.com/oSTpzOm
>
> Thanks.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/getChoices-from-ListMultipleChoice-tp4650725p4650745.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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


Re: getChoices from ListMultipleChoice

Posted by cosmindumy <co...@yahoo.com>.
Hi,
Just tried at home and still get null on getModelObject(). 
Here is the complete code: 
http://shorttext.com/oSTpzOm

Thanks. 



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/getChoices-from-ListMultipleChoice-tp4650725p4650745.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: getChoices from ListMultipleChoice

Posted by Igor Vaynberg <ig...@gmail.com>.
(Collection)getModelObject()

-igor

On Mon, Jul 23, 2012 at 4:53 PM, cosmindumy <co...@yahoo.com> wrote:
> Hi,
> I'm trying to get the selected options from a ListMultipleChoice but didn't
> find a method to get a collection of selected options.
> I'm using the getValue method that return a String of choices separated by ;
> but I'm sure is not right.
> What method should I use?
> Thanks.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/getChoices-from-ListMultipleChoice-tp4650725.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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


Re: getChoices from ListMultipleChoice

Posted by Thomas Matthijs <li...@selckin.be>.
On Mon, Jul 23, 2012 at 3:53 PM, cosmindumy <co...@yahoo.com> wrote:
> Hi,
> I'm trying to get the selected options from a ListMultipleChoice but didn't
> find a method to get a collection of selected options.
> I'm using the getValue method that return a String of choices separated by ;
> but I'm sure is not right.
> What method should I use?

getModel(), getModelObject()

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