You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jchappelle <jc...@4redi.com> on 2008/12/06 02:31:07 UTC

CheckGroup model only has one element

I have a CheckGroup inside of a WizardStep panel. In the constructor I am
giving it a PropertyModel like this:

final CheckGroup group = new CheckGroup("group", new
PropertyModel(RegistrationWizard.this, "contacts"));

My wizard class has a setContacts and a getContacts that take a Set and
return a Set respectively. I add a ListView to this group:

			Form form = new Form("form");
			group.add(new CheckGroupSelector("groupselector"));
			ListView contacts = new ListView("contacts", contactsModel)
			{
				private static final long serialVersionUID = 1L;

				@Override
				protected void populateItem(ListItem item)
				{
					Contact contact = (Contact)item.getModelObject();
					Check contactCheckBox = new Check("contactCheckBox", item.getModel());
					
					Model titleModel = null;
					if(contact.getName() == null || contact.getName().trim().length() == 0)
					{
						titleModel = new Model(contact.getEmailAddress());
					}
					else
					{
						titleModel = new Model(contact.getName());
					}
					Label contactTitle = new Label("contactTitle", titleModel);
					Label contactEmail = new Label("contactEmail", new
Model(contact.getEmailAddress()));
					item.add(contactCheckBox);
					item.add(contactTitle);
					item.add(contactEmail);
				}
			};


The top checked contact is always the one returned. It never has the full
collection of selections in my contacts Set. I have been beating my head
over this for hours. Could someone please help!!! I am using wicket 1.3.4

Thanks,

Josh
-- 
View this message in context: http://www.nabble.com/CheckGroup-model-only-has-one-element-tp20865674p20865674.html
Sent from the Wicket - User 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: CheckGroup model only has one element

Posted by James Carman <ja...@carmanconsulting.com>.
Can you show us more code?  You're not showing us what is being added to
what (like form, group, contacts, etc.).  We don't see the nesting here.

On Fri, Dec 5, 2008 at 8:31 PM, jchappelle <jc...@4redi.com> wrote:

>
> I have a CheckGroup inside of a WizardStep panel. In the constructor I am
> giving it a PropertyModel like this:
>
> final CheckGroup group = new CheckGroup("group", new
> PropertyModel(RegistrationWizard.this, "contacts"));
>
> My wizard class has a setContacts and a getContacts that take a Set and
> return a Set respectively. I add a ListView to this group:
>
>                        Form form = new Form("form");
>                        group.add(new CheckGroupSelector("groupselector"));
>                        ListView contacts = new ListView("contacts",
> contactsModel)
>                        {
>                                private static final long serialVersionUID =
> 1L;
>
>                                @Override
>                                protected void populateItem(ListItem item)
>                                {
>                                        Contact contact =
> (Contact)item.getModelObject();
>                                        Check contactCheckBox = new
> Check("contactCheckBox", item.getModel());
>
>                                        Model titleModel = null;
>                                        if(contact.getName() == null ||
> contact.getName().trim().length() == 0)
>                                        {
>                                                titleModel = new
> Model(contact.getEmailAddress());
>                                        }
>                                        else
>                                        {
>                                                titleModel = new
> Model(contact.getName());
>                                        }
>                                        Label contactTitle = new
> Label("contactTitle", titleModel);
>                                        Label contactEmail = new
> Label("contactEmail", new
> Model(contact.getEmailAddress()));
>                                        item.add(contactCheckBox);
>                                        item.add(contactTitle);
>                                        item.add(contactEmail);
>                                }
>                        };
>
>
> The top checked contact is always the one returned. It never has the full
> collection of selections in my contacts Set. I have been beating my head
> over this for hours. Could someone please help!!! I am using wicket 1.3.4
>
> Thanks,
>
> Josh
> --
> View this message in context:
> http://www.nabble.com/CheckGroup-model-only-has-one-element-tp20865674p20865674.html
> Sent from the Wicket - User 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
>
>