Hi

jensiator wrote:
Put in one case I Noticed that all the WizardSteps uses the same
backingbean, so I started to think about using a compoundpropertymodel that
I set to the Wizard in its constuctor. Something like this:
public MywizardConstuctor(String id){
   super(id);
   CompoundPropertyModel<BackingBean> formModel = new
CompoundPropertyModel<BackingBean>(new BackingBean());
    setDefaultModel(formModel);
    WizardModel wizardmodel = new WizardModel();
    wizardmodel.add(new WizardStep1());
    wizardmodel.add(new WizardStep2());
    init(wizardmodel);
}
TextField firstnameTF = new TextField<String>("firstName",new
PropertyModel<String>(getDefaultModel(), "nestedobj.firstname"));
But I cant make it work! The former TextField code works, but the one with
getDeafultModel() doesnt. The defaultModel is null. I tryid to
findParent(Wizard.class).getDefaultModel() but it failes, probably because
the Step has not been added to the WizardModel yet.
Can anyone explain to me why 'new TextField<String>("firstName")' works?
Jens Aleniu
Looks like you're using 1.4, but I can explain you how I'm doing it in 1.3:

In the wizard:
IModel model = new CompoundPropertyModel(this);
setModel(model); // i dont have a setDefaultModel() - Maybe that's the difference?
WizardModel wizardModel = new WizardModel();
wizardModel.add(new MyStep(model));

Like that I already have the model in my step (MyStep)

There I'm doing:
setModel(model);  // again, I dont have a setDefaultModel()
add(new TextField("my.id", new PropertyModel(getModel(), "propertyName"));

In your example, you're not passing the model to the steps - that's why it cannot be there.

The above example works for me in Wicket 1.3.x, so I think it shouldn't be that different in your case.

Matt

--
[EMAIL PROTECTED]  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
______________________________________________________________
e r g o n    smart people - smart software


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to