Re: Wizard using ListView and RadioGroup

2010-03-29 Thread Martijn Dashorst
userAddresses.setReuseItems(true)

Martijn

2010/3/28 Robert Gründler :
> Hi all,
>
> i'm working on a Wizard that displays a list of Addresses in one step, where
> an address can be selected using a radiobutton.
>
> The relevant code of the addresslist-wizardstep looks like this:
>
> addressList = new ArrayList(user.getAddresses());
> final RadioGroup group = new RadioGroup("group", new 
> CompoundPropertyModel(addressList));
> add(group);
>
> ListView userAddresses = new ListView("addresses", 
> addressList) {
>       �...@override
>        protected void populateItem(ListItem item) {
>                item.setDefaultModel(new 
> CompoundPropertyModel(item.getModelObject()));
>                item.add(new Radio("is_default"));
>                item.add(new Label("address.street"));
>                item.add(new Label("address.zip"));
>                item.add(new Label("address.city"));
>                item.add(new Label("address.country"));
>        }
> };
>
> group.add(userAddresses);
> group.setRequired(true);
>
> My Problem is that i need to select an address by default based on the 
> is_default field in the UserAddress jointable, but only
> when the wizardStep is displayed for the first time. If the user changes the 
> selected address, it should not jump back
> to the is_default value when switching back and forth between wizard-steps.
>
> I've already tried the solution described in the wiki for setting default 
> values to radiogroups (http://cwiki.apache.org/WICKET/using-radiogroups.html),
> but this resets the selected radiobutton when switching wizard pages to the 
> default value, so the wizard doesn't "remember"  if a default option
> has been changed by the user.
>
> I'd appreciate any hints on how to solve this one.
>
>
> thanks!
>
>
> -robert
>
>
>
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4

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



Wizard using ListView and RadioGroup

2010-03-28 Thread Robert Gründler
Hi all,

i'm working on a Wizard that displays a list of Addresses in one step, where
an address can be selected using a radiobutton.

The relevant code of the addresslist-wizardstep looks like this:

addressList = new ArrayList(user.getAddresses());
final RadioGroup group = new RadioGroup("group", new 
CompoundPropertyModel(addressList));
add(group);

ListView userAddresses = new ListView("addresses", 
addressList) {
@Override
protected void populateItem(ListItem item) {
item.setDefaultModel(new 
CompoundPropertyModel(item.getModelObject()));
item.add(new Radio("is_default"));  

item.add(new Label("address.street"));
item.add(new Label("address.zip"));
item.add(new Label("address.city"));
item.add(new Label("address.country"));
}
};

group.add(userAddresses);
group.setRequired(true);

My Problem is that i need to select an address by default based on the 
is_default field in the UserAddress jointable, but only
when the wizardStep is displayed for the first time. If the user changes the 
selected address, it should not jump back
to the is_default value when switching back and forth between wizard-steps.

I've already tried the solution described in the wiki for setting default 
values to radiogroups (http://cwiki.apache.org/WICKET/using-radiogroups.html),
but this resets the selected radiobutton when switching wizard pages to the 
default value, so the wizard doesn't "remember"  if a default option
has been changed by the user.

I'd appreciate any hints on how to solve this one.


thanks!


-robert