You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Trojahn, Cassia" <ca...@xrce.xerox.com> on 2009/07/15 15:06:14 UTC

Radio and Radio Group problems

Dear All

I have a problem when using the Radio component.
Using a list of languages, where each item is a NameWrapper object with 
a property "selected". The property "selected" is associated to the 
radio component.
However, when presenting to the user the corresponding list of radios, 
the language Polish is true, and not English (it should be the selected 
option).

 listLanguages.add(new NameWrapper("English", "en", "", true));
 listLanguages.add(new NameWrapper("German", "de", "", false));
 listLanguages.add(new NameWrapper("French", "fr", "", false));
 listLanguages.add(new NameWrapper("Italian", "it", "", false));
 listLanguages.add(new NameWrapper("Polish", "pl", "", false));

 final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", new 
Model());
 listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages) {
            protected void populateItem(ListItem item) {
                 String lang = 
((NameWrapper)item.getModelObject()).getName();
                item.add(new Label("nameLanguageQuery", new 
StringResourceModel(lang, this, null,"XXXX")));
                item.add(new Radio("checkLanguageQuery", new 
PropertyModel(item.getModel(), "selected"),groupQuery));
            }
        };
groupQuery.add(listLanguagesQuery);

Any ideas? I really need to solve this issue.

Thank you so much.

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


Re: Radio and Radio Group problems

Posted by Michael Mosmann <mi...@mosmann.de>.
Am Mittwoch, den 15.07.2009, 16:02 +0200 schrieb Trojahn, Cassia:
> I had tried this option and it does not work.

can you send me some more code (zip?) ..

please use 
http://wicket.apache.org/quickstart.html

mm:)



Re: Radio and Radio Group problems

Posted by Igor Vaynberg <ig...@gmail.com>.
where and how are you actually pulling out the selection?

-igor

On Fri, Jul 17, 2009 at 1:21 AM, Trojahn,
Cassia<ca...@xrce.xerox.com> wrote:
> Igor Vaynberg wrote:
>>
>> where is your Form in your example?
>>
>> -igor
>>
>> On Thu, Jul 16, 2009 at 7:04 AM, Trojahn,
>> Cassia<ca...@xrce.xerox.com> wrote:
>>
>>>
>>> Trojahn, Cassia wrote:
>>>
>>>>
>>>> Always the last of the list is the selected.
>>>> I had tried also this proposal .. and it does not work.
>>>>
>>>> Michael O'Cleirigh wrote:
>>>>
>>>>>
>>>>> Hello,
>>>>>
>>>>> I don't think you need to track the selected (true/false) state your
>>>>> self.  Let the radio group model do it automatically for you like:
>>>>>
>>>>> listLanguages.add(new NameWrapper("English", "en", "");
>>>>> listLanguages.add(new NameWrapper("German", "de", ""));
>>>>> listLanguages.add(new NameWrapper("French", "fr", ""));
>>>>> listLanguages.add(new NameWrapper("Italian", "it", "");
>>>>> listLanguages.add(new NameWrapper("Polish", "pl", "");
>>>>>
>>>>> // set the selected radio to be the first in the list 'English'
>>>>> final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", new
>>>>> Model<NameWrapper>(listLanguages.get(0)));
>>>>> listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages) {
>>>>>          protected void populateItem(ListItem item) {
>>>>>               String lang =
>>>>> ((NameWrapper)item.getModelObject()).getName();
>>>>>              item.add(new Label("nameLanguageQuery", new
>>>>> StringResourceModel(lang, this, null,"XXXX")));
>>>>>              item.add(new Radio("checkLanguageQuery",
>>>>> item.getModel(),groupQuery));
>>>>>          }
>>>>>      };
>>>>>
>>>>> groupQuery.add(listLanguagesQuery);
>>>>>
>>>>> Now the model object value of the RadioGroup 'groupQuery' will have the
>>>>> NameWrapper for the selected choice.  A NameWrapper instance is
>>>>> selected if
>>>>> it is returned by groupQuery.getModelObject();
>>>>>
>>>>> Regards,
>>>>>
>>>>> Mike
>>>>>
>>>>>>
>>>>>> I had tried this option and it does not work.
>>>>>>
>>>>>> Michael Mosmann wrote:
>>>>>>
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> .. i am not sure. The model of RadioGroup should contain, wich item
>>>>>>> is
>>>>>>> selected. The model of Radio should reflect the associated value. So
>>>>>>> if
>>>>>>> model of RadioGroup contains "fr" and Property "selected" of item nr.
>>>>>>> 3
>>>>>>> is "fr" this Radio is selected.
>>>>>>>
>>>>>>> maybe this will help..
>>>>>>> mm:)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> I have a problem when using the Radio component.
>>>>>>>> Using a list of languages, where each item is a NameWrapper object
>>>>>>>> with a property "selected". The property "selected" is associated to
>>>>>>>> the
>>>>>>>> radio component.
>>>>>>>> However, when presenting to the user the corresponding list of
>>>>>>>> radios,
>>>>>>>> the language Polish is true, and not English (it should be the
>>>>>>>> selected
>>>>>>>> option).
>>>>>>>>
>>>>>>>>  listLanguages.add(new NameWrapper("English", "en", "", true));
>>>>>>>>  listLanguages.add(new NameWrapper("German", "de", "", false));
>>>>>>>>  listLanguages.add(new NameWrapper("French", "fr", "", false));
>>>>>>>>  listLanguages.add(new NameWrapper("Italian", "it", "", false));
>>>>>>>>  listLanguages.add(new NameWrapper("Polish", "pl", "", false));
>>>>>>>>
>>>>>>>>  final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery",
>>>>>>>> new Model());
>>>>>>>>  listLanguagesQuery = new
>>>>>>>> ListView("listLanguagesQuery",listLanguages)
>>>>>>>> {
>>>>>>>>           protected void populateItem(ListItem item) {
>>>>>>>>                String lang =
>>>>>>>> ((NameWrapper)item.getModelObject()).getName();
>>>>>>>>               item.add(new Label("nameLanguageQuery", new
>>>>>>>> StringResourceModel(lang, this, null,"XXXX")));
>>>>>>>>               item.add(new Radio("checkLanguageQuery", new
>>>>>>>> PropertyModel(item.getModel(), "selected"),groupQuery));
>>>>>>>>           }
>>>>>>>>       };
>>>>>>>> groupQuery.add(listLanguagesQuery);
>>>>>>>>
>>>>>>>> Any ideas? I really need to solve this issue.
>>>>>>>>
>>>>>>>> Thank you so much.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>>
>>>>
>>>
>>> I send the code of the application.
>>> if someone can help me ....
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
> Thank you for your reply, but with the form the problem is not solved (I
> attach the code with the form).
> Any other idea?
>
>
>
> ---------------------------------------------------------------------
> 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: Radio and Radio Group problems

Posted by "Trojahn, Cassia" <ca...@xrce.xerox.com>.
Igor Vaynberg wrote:
> where is your Form in your example?
>
> -igor
>
> On Thu, Jul 16, 2009 at 7:04 AM, Trojahn,
> Cassia<ca...@xrce.xerox.com> wrote:
>   
>> Trojahn, Cassia wrote:
>>     
>>> Always the last of the list is the selected.
>>> I had tried also this proposal .. and it does not work.
>>>
>>> Michael O'Cleirigh wrote:
>>>       
>>>> Hello,
>>>>
>>>> I don't think you need to track the selected (true/false) state your
>>>> self.  Let the radio group model do it automatically for you like:
>>>>
>>>> listLanguages.add(new NameWrapper("English", "en", "");
>>>> listLanguages.add(new NameWrapper("German", "de", ""));
>>>> listLanguages.add(new NameWrapper("French", "fr", ""));
>>>> listLanguages.add(new NameWrapper("Italian", "it", "");
>>>> listLanguages.add(new NameWrapper("Polish", "pl", "");
>>>>
>>>> // set the selected radio to be the first in the list 'English'
>>>> final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", new
>>>> Model<NameWrapper>(listLanguages.get(0)));
>>>> listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages) {
>>>>           protected void populateItem(ListItem item) {
>>>>                String lang =
>>>> ((NameWrapper)item.getModelObject()).getName();
>>>>               item.add(new Label("nameLanguageQuery", new
>>>> StringResourceModel(lang, this, null,"XXXX")));
>>>>               item.add(new Radio("checkLanguageQuery",
>>>> item.getModel(),groupQuery));
>>>>           }
>>>>       };
>>>>
>>>> groupQuery.add(listLanguagesQuery);
>>>>
>>>> Now the model object value of the RadioGroup 'groupQuery' will have the
>>>> NameWrapper for the selected choice.  A NameWrapper instance is selected if
>>>> it is returned by groupQuery.getModelObject();
>>>>
>>>> Regards,
>>>>
>>>> Mike
>>>>         
>>>>> I had tried this option and it does not work.
>>>>>
>>>>> Michael Mosmann wrote:
>>>>>           
>>>>>> Hi,
>>>>>>
>>>>>> .. i am not sure. The model of RadioGroup should contain, wich item is
>>>>>> selected. The model of Radio should reflect the associated value. So if
>>>>>> model of RadioGroup contains "fr" and Property "selected" of item nr. 3
>>>>>> is "fr" this Radio is selected.
>>>>>>
>>>>>> maybe this will help..
>>>>>> mm:)
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> I have a problem when using the Radio component.
>>>>>>> Using a list of languages, where each item is a NameWrapper object
>>>>>>> with a property "selected". The property "selected" is associated to the
>>>>>>> radio component.
>>>>>>> However, when presenting to the user the corresponding list of radios,
>>>>>>> the language Polish is true, and not English (it should be the selected
>>>>>>> option).
>>>>>>>
>>>>>>>  listLanguages.add(new NameWrapper("English", "en", "", true));
>>>>>>>  listLanguages.add(new NameWrapper("German", "de", "", false));
>>>>>>>  listLanguages.add(new NameWrapper("French", "fr", "", false));
>>>>>>>  listLanguages.add(new NameWrapper("Italian", "it", "", false));
>>>>>>>  listLanguages.add(new NameWrapper("Polish", "pl", "", false));
>>>>>>>
>>>>>>>  final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery",
>>>>>>> new Model());
>>>>>>>  listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages)
>>>>>>> {
>>>>>>>            protected void populateItem(ListItem item) {
>>>>>>>                 String lang =
>>>>>>> ((NameWrapper)item.getModelObject()).getName();
>>>>>>>                item.add(new Label("nameLanguageQuery", new
>>>>>>> StringResourceModel(lang, this, null,"XXXX")));
>>>>>>>                item.add(new Radio("checkLanguageQuery", new
>>>>>>> PropertyModel(item.getModel(), "selected"),groupQuery));
>>>>>>>            }
>>>>>>>        };
>>>>>>> groupQuery.add(listLanguagesQuery);
>>>>>>>
>>>>>>> Any ideas? I really need to solve this issue.
>>>>>>>
>>>>>>> Thank you so much.
>>>>>>>
>>>>>>>               
>>>>>>             
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>       
>> I send the code of the application.
>> if someone can help me ....
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>   
Thank you for your reply, but with the form the problem is not solved (I 
attach the code with the form).
Any other idea?


Re: Radio and Radio Group problems

Posted by Igor Vaynberg <ig...@gmail.com>.
where is your Form in your example?

-igor

On Thu, Jul 16, 2009 at 7:04 AM, Trojahn,
Cassia<ca...@xrce.xerox.com> wrote:
> Trojahn, Cassia wrote:
>>
>> Always the last of the list is the selected.
>> I had tried also this proposal .. and it does not work.
>>
>> Michael O'Cleirigh wrote:
>>>
>>> Hello,
>>>
>>> I don't think you need to track the selected (true/false) state your
>>> self.  Let the radio group model do it automatically for you like:
>>>
>>> listLanguages.add(new NameWrapper("English", "en", "");
>>> listLanguages.add(new NameWrapper("German", "de", ""));
>>> listLanguages.add(new NameWrapper("French", "fr", ""));
>>> listLanguages.add(new NameWrapper("Italian", "it", "");
>>> listLanguages.add(new NameWrapper("Polish", "pl", "");
>>>
>>> // set the selected radio to be the first in the list 'English'
>>> final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", new
>>> Model<NameWrapper>(listLanguages.get(0)));
>>> listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages) {
>>>           protected void populateItem(ListItem item) {
>>>                String lang =
>>> ((NameWrapper)item.getModelObject()).getName();
>>>               item.add(new Label("nameLanguageQuery", new
>>> StringResourceModel(lang, this, null,"XXXX")));
>>>               item.add(new Radio("checkLanguageQuery",
>>> item.getModel(),groupQuery));
>>>           }
>>>       };
>>>
>>> groupQuery.add(listLanguagesQuery);
>>>
>>> Now the model object value of the RadioGroup 'groupQuery' will have the
>>> NameWrapper for the selected choice.  A NameWrapper instance is selected if
>>> it is returned by groupQuery.getModelObject();
>>>
>>> Regards,
>>>
>>> Mike
>>>>
>>>> I had tried this option and it does not work.
>>>>
>>>> Michael Mosmann wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> .. i am not sure. The model of RadioGroup should contain, wich item is
>>>>> selected. The model of Radio should reflect the associated value. So if
>>>>> model of RadioGroup contains "fr" and Property "selected" of item nr. 3
>>>>> is "fr" this Radio is selected.
>>>>>
>>>>> maybe this will help..
>>>>> mm:)
>>>>>
>>>>>
>>>>>>
>>>>>> I have a problem when using the Radio component.
>>>>>> Using a list of languages, where each item is a NameWrapper object
>>>>>> with a property "selected". The property "selected" is associated to the
>>>>>> radio component.
>>>>>> However, when presenting to the user the corresponding list of radios,
>>>>>> the language Polish is true, and not English (it should be the selected
>>>>>> option).
>>>>>>
>>>>>>  listLanguages.add(new NameWrapper("English", "en", "", true));
>>>>>>  listLanguages.add(new NameWrapper("German", "de", "", false));
>>>>>>  listLanguages.add(new NameWrapper("French", "fr", "", false));
>>>>>>  listLanguages.add(new NameWrapper("Italian", "it", "", false));
>>>>>>  listLanguages.add(new NameWrapper("Polish", "pl", "", false));
>>>>>>
>>>>>>  final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery",
>>>>>> new Model());
>>>>>>  listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages)
>>>>>> {
>>>>>>            protected void populateItem(ListItem item) {
>>>>>>                 String lang =
>>>>>> ((NameWrapper)item.getModelObject()).getName();
>>>>>>                item.add(new Label("nameLanguageQuery", new
>>>>>> StringResourceModel(lang, this, null,"XXXX")));
>>>>>>                item.add(new Radio("checkLanguageQuery", new
>>>>>> PropertyModel(item.getModel(), "selected"),groupQuery));
>>>>>>            }
>>>>>>        };
>>>>>> groupQuery.add(listLanguagesQuery);
>>>>>>
>>>>>> Any ideas? I really need to solve this issue.
>>>>>>
>>>>>> Thank you so much.
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
> I send the code of the application.
> if someone can help me ....
>
>
> ---------------------------------------------------------------------
> 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: Radio and Radio Group problems

Posted by "Trojahn, Cassia" <ca...@xrce.xerox.com>.
Trojahn, Cassia wrote:
> Always the last of the list is the selected.
> I had tried also this proposal .. and it does not work.
>
> Michael O'Cleirigh wrote:
>> Hello,
>>
>> I don't think you need to track the selected (true/false) state your 
>> self.  Let the radio group model do it automatically for you like:
>>
>> listLanguages.add(new NameWrapper("English", "en", "");
>> listLanguages.add(new NameWrapper("German", "de", ""));
>> listLanguages.add(new NameWrapper("French", "fr", ""));
>> listLanguages.add(new NameWrapper("Italian", "it", "");
>> listLanguages.add(new NameWrapper("Polish", "pl", "");
>>
>> // set the selected radio to be the first in the list 'English'
>> final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", 
>> new Model<NameWrapper>(listLanguages.get(0)));
>> listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages) {
>>            protected void populateItem(ListItem item) {
>>                 String lang = 
>> ((NameWrapper)item.getModelObject()).getName();
>>                item.add(new Label("nameLanguageQuery", new 
>> StringResourceModel(lang, this, null,"XXXX")));
>>                item.add(new Radio("checkLanguageQuery", 
>> item.getModel(),groupQuery));
>>            }
>>        };
>>
>> groupQuery.add(listLanguagesQuery);
>>
>> Now the model object value of the RadioGroup 'groupQuery' will have 
>> the NameWrapper for the selected choice.  A NameWrapper instance is 
>> selected if it is returned by groupQuery.getModelObject();
>>
>> Regards,
>>
>> Mike
>>> I had tried this option and it does not work.
>>>
>>> Michael Mosmann wrote:
>>>> Hi,
>>>>
>>>> .. i am not sure. The model of RadioGroup should contain, wich item is
>>>> selected. The model of Radio should reflect the associated value. 
>>>> So if
>>>> model of RadioGroup contains "fr" and Property "selected" of item 
>>>> nr. 3
>>>> is "fr" this Radio is selected.
>>>>
>>>> maybe this will help..
>>>> mm:)
>>>>
>>>>  
>>>>> I have a problem when using the Radio component.
>>>>> Using a list of languages, where each item is a NameWrapper object 
>>>>> with a property "selected". The property "selected" is associated 
>>>>> to the radio component.
>>>>> However, when presenting to the user the corresponding list of 
>>>>> radios, the language Polish is true, and not English (it should be 
>>>>> the selected option).
>>>>>
>>>>>  listLanguages.add(new NameWrapper("English", "en", "", true));
>>>>>  listLanguages.add(new NameWrapper("German", "de", "", false));
>>>>>  listLanguages.add(new NameWrapper("French", "fr", "", false));
>>>>>  listLanguages.add(new NameWrapper("Italian", "it", "", false));
>>>>>  listLanguages.add(new NameWrapper("Polish", "pl", "", false));
>>>>>
>>>>>  final RadioGroup groupQuery = new 
>>>>> RadioGroup("groupLanguagesQuery", new Model());
>>>>>  listLanguagesQuery = new 
>>>>> ListView("listLanguagesQuery",listLanguages) {
>>>>>             protected void populateItem(ListItem item) {
>>>>>                  String lang = 
>>>>> ((NameWrapper)item.getModelObject()).getName();
>>>>>                 item.add(new Label("nameLanguageQuery", new 
>>>>> StringResourceModel(lang, this, null,"XXXX")));
>>>>>                 item.add(new Radio("checkLanguageQuery", new 
>>>>> PropertyModel(item.getModel(), "selected"),groupQuery));
>>>>>             }
>>>>>         };
>>>>> groupQuery.add(listLanguagesQuery);
>>>>>
>>>>> Any ideas? I really need to solve this issue.
>>>>>
>>>>> Thank you so much.
>>>>>     
>>>>
>>>>   
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
I send the code of the application.
if someone can help me ....

Re: Radio and Radio Group problems

Posted by "Trojahn, Cassia" <ca...@xrce.xerox.com>.
Always the last of the list is the selected.
I had tried also this proposal .. and it does not work.

Michael O'Cleirigh wrote:
> Hello,
>
> I don't think you need to track the selected (true/false) state your 
> self.  Let the radio group model do it automatically for you like:
>
> listLanguages.add(new NameWrapper("English", "en", "");
> listLanguages.add(new NameWrapper("German", "de", ""));
> listLanguages.add(new NameWrapper("French", "fr", ""));
> listLanguages.add(new NameWrapper("Italian", "it", "");
> listLanguages.add(new NameWrapper("Polish", "pl", "");
>
> // set the selected radio to be the first in the list 'English'
> final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", 
> new Model<NameWrapper>(listLanguages.get(0)));
> listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages) {
>            protected void populateItem(ListItem item) {
>                 String lang = 
> ((NameWrapper)item.getModelObject()).getName();
>                item.add(new Label("nameLanguageQuery", new 
> StringResourceModel(lang, this, null,"XXXX")));
>                item.add(new Radio("checkLanguageQuery", 
> item.getModel(),groupQuery));
>            }
>        };
>
> groupQuery.add(listLanguagesQuery);
>
> Now the model object value of the RadioGroup 'groupQuery' will have 
> the NameWrapper for the selected choice.  A NameWrapper instance is 
> selected if it is returned by groupQuery.getModelObject();
>
> Regards,
>
> Mike
>> I had tried this option and it does not work.
>>
>> Michael Mosmann wrote:
>>> Hi,
>>>
>>> .. i am not sure. The model of RadioGroup should contain, wich item is
>>> selected. The model of Radio should reflect the associated value. So if
>>> model of RadioGroup contains "fr" and Property "selected" of item nr. 3
>>> is "fr" this Radio is selected.
>>>
>>> maybe this will help..
>>> mm:)
>>>
>>>  
>>>> I have a problem when using the Radio component.
>>>> Using a list of languages, where each item is a NameWrapper object 
>>>> with a property "selected". The property "selected" is associated 
>>>> to the radio component.
>>>> However, when presenting to the user the corresponding list of 
>>>> radios, the language Polish is true, and not English (it should be 
>>>> the selected option).
>>>>
>>>>  listLanguages.add(new NameWrapper("English", "en", "", true));
>>>>  listLanguages.add(new NameWrapper("German", "de", "", false));
>>>>  listLanguages.add(new NameWrapper("French", "fr", "", false));
>>>>  listLanguages.add(new NameWrapper("Italian", "it", "", false));
>>>>  listLanguages.add(new NameWrapper("Polish", "pl", "", false));
>>>>
>>>>  final RadioGroup groupQuery = new 
>>>> RadioGroup("groupLanguagesQuery", new Model());
>>>>  listLanguagesQuery = new 
>>>> ListView("listLanguagesQuery",listLanguages) {
>>>>             protected void populateItem(ListItem item) {
>>>>                  String lang = 
>>>> ((NameWrapper)item.getModelObject()).getName();
>>>>                 item.add(new Label("nameLanguageQuery", new 
>>>> StringResourceModel(lang, this, null,"XXXX")));
>>>>                 item.add(new Radio("checkLanguageQuery", new 
>>>> PropertyModel(item.getModel(), "selected"),groupQuery));
>>>>             }
>>>>         };
>>>> groupQuery.add(listLanguagesQuery);
>>>>
>>>> Any ideas? I really need to solve this issue.
>>>>
>>>> Thank you so much.
>>>>     
>>>
>>>   
>>
>
>
> ---------------------------------------------------------------------
> 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: Radio and Radio Group problems

Posted by Michael O'Cleirigh <mi...@rivulet.ca>.
Hello,

I don't think you need to track the selected (true/false) state your 
self.  Let the radio group model do it automatically for you like:

listLanguages.add(new NameWrapper("English", "en", "");
 listLanguages.add(new NameWrapper("German", "de", ""));
 listLanguages.add(new NameWrapper("French", "fr", ""));
 listLanguages.add(new NameWrapper("Italian", "it", "");
 listLanguages.add(new NameWrapper("Polish", "pl", "");

// set the selected radio to be the first in the list 'English'
 final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", new 
Model<NameWrapper>(listLanguages.get(0)));
 listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages) {
            protected void populateItem(ListItem item) {
                 String lang = 
((NameWrapper)item.getModelObject()).getName();
                item.add(new Label("nameLanguageQuery", new 
StringResourceModel(lang, this, null,"XXXX")));
                item.add(new Radio("checkLanguageQuery", 
item.getModel(),groupQuery));
            }
        };

groupQuery.add(listLanguagesQuery);

Now the model object value of the RadioGroup 'groupQuery' will have the 
NameWrapper for the selected choice.  A NameWrapper instance is selected 
if it is returned by groupQuery.getModelObject();

Regards,

Mike
> I had tried this option and it does not work.
>
> Michael Mosmann wrote:
>> Hi,
>>
>> .. i am not sure. The model of RadioGroup should contain, wich item is
>> selected. The model of Radio should reflect the associated value. So if
>> model of RadioGroup contains "fr" and Property "selected" of item nr. 3
>> is "fr" this Radio is selected.
>>
>> maybe this will help..
>> mm:)
>>
>>  
>>> I have a problem when using the Radio component.
>>> Using a list of languages, where each item is a NameWrapper object 
>>> with a property "selected". The property "selected" is associated to 
>>> the radio component.
>>> However, when presenting to the user the corresponding list of 
>>> radios, the language Polish is true, and not English (it should be 
>>> the selected option).
>>>
>>>  listLanguages.add(new NameWrapper("English", "en", "", true));
>>>  listLanguages.add(new NameWrapper("German", "de", "", false));
>>>  listLanguages.add(new NameWrapper("French", "fr", "", false));
>>>  listLanguages.add(new NameWrapper("Italian", "it", "", false));
>>>  listLanguages.add(new NameWrapper("Polish", "pl", "", false));
>>>
>>>  final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", 
>>> new Model());
>>>  listLanguagesQuery = new 
>>> ListView("listLanguagesQuery",listLanguages) {
>>>             protected void populateItem(ListItem item) {
>>>                  String lang = 
>>> ((NameWrapper)item.getModelObject()).getName();
>>>                 item.add(new Label("nameLanguageQuery", new 
>>> StringResourceModel(lang, this, null,"XXXX")));
>>>                 item.add(new Radio("checkLanguageQuery", new 
>>> PropertyModel(item.getModel(), "selected"),groupQuery));
>>>             }
>>>         };
>>> groupQuery.add(listLanguagesQuery);
>>>
>>> Any ideas? I really need to solve this issue.
>>>
>>> Thank you so much.
>>>     
>>
>>   
>


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


Re: Radio and Radio Group problems

Posted by "Trojahn, Cassia" <ca...@xrce.xerox.com>.
I had tried this option and it does not work.

Michael Mosmann wrote:
> Hi,
>
> .. i am not sure. The model of RadioGroup should contain, wich item is
> selected. The model of Radio should reflect the associated value. So if
> model of RadioGroup contains "fr" and Property "selected" of item nr. 3
> is "fr" this Radio is selected.
>
> maybe this will help.. 
>
> mm:)
>
>   
>> I have a problem when using the Radio component.
>> Using a list of languages, where each item is a NameWrapper object with 
>> a property "selected". The property "selected" is associated to the 
>> radio component.
>> However, when presenting to the user the corresponding list of radios, 
>> the language Polish is true, and not English (it should be the selected 
>> option).
>>
>>  listLanguages.add(new NameWrapper("English", "en", "", true));
>>  listLanguages.add(new NameWrapper("German", "de", "", false));
>>  listLanguages.add(new NameWrapper("French", "fr", "", false));
>>  listLanguages.add(new NameWrapper("Italian", "it", "", false));
>>  listLanguages.add(new NameWrapper("Polish", "pl", "", false));
>>
>>  final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", new 
>> Model());
>>  listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages) {
>>             protected void populateItem(ListItem item) {
>>                  String lang = 
>> ((NameWrapper)item.getModelObject()).getName();
>>                 item.add(new Label("nameLanguageQuery", new 
>> StringResourceModel(lang, this, null,"XXXX")));
>>                 item.add(new Radio("checkLanguageQuery", new 
>> PropertyModel(item.getModel(), "selected"),groupQuery));
>>             }
>>         };
>> groupQuery.add(listLanguagesQuery);
>>
>> Any ideas? I really need to solve this issue.
>>
>> Thank you so much.
>>     
>
>   


Re: Radio and Radio Group problems

Posted by Michael Mosmann <mi...@mosmann.de>.
Hi,

.. i am not sure. The model of RadioGroup should contain, wich item is
selected. The model of Radio should reflect the associated value. So if
model of RadioGroup contains "fr" and Property "selected" of item nr. 3
is "fr" this Radio is selected.

maybe this will help.. 

mm:)

> I have a problem when using the Radio component.
> Using a list of languages, where each item is a NameWrapper object with 
> a property "selected". The property "selected" is associated to the 
> radio component.
> However, when presenting to the user the corresponding list of radios, 
> the language Polish is true, and not English (it should be the selected 
> option).
> 
>  listLanguages.add(new NameWrapper("English", "en", "", true));
>  listLanguages.add(new NameWrapper("German", "de", "", false));
>  listLanguages.add(new NameWrapper("French", "fr", "", false));
>  listLanguages.add(new NameWrapper("Italian", "it", "", false));
>  listLanguages.add(new NameWrapper("Polish", "pl", "", false));
> 
>  final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", new 
> Model());
>  listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages) {
>             protected void populateItem(ListItem item) {
>                  String lang = 
> ((NameWrapper)item.getModelObject()).getName();
>                 item.add(new Label("nameLanguageQuery", new 
> StringResourceModel(lang, this, null,"XXXX")));
>                 item.add(new Radio("checkLanguageQuery", new 
> PropertyModel(item.getModel(), "selected"),groupQuery));
>             }
>         };
> groupQuery.add(listLanguagesQuery);
> 
> Any ideas? I really need to solve this issue.
> 
> Thank you so much.