Hi Jan,

when are data2 and data3 initialized? They seems to be null when you put up your models.

Most of the time it's a bad idea to pull something out of a model and put it back into another model.
Do this instead:

    this.add(new MyPanel(id2, new PropertyModel(model, "data2")));

Then in MyPanel:

    public MyPanel(id, model){
         super(id, new CompoundPropertyModel(model));

This has the following advantages:
- MyPanel's model is always in sync with the model of MyForm.
- MyPanel's usage of CompoundPropertyModel is hidden from the outside. If MyPanel want's to utilize a CompoundPropertyModel (because it doesn't set the model on its contained components), it should set it up by itself.

HTH

Sven




On 10/22/2010 06:29 PM, Jan Ferko wrote:
Hi,

I am doing on form which consists of multiple panels and data object
hierarchy to them.

For example:

class Data1 {
    Data2 data2;
}

class Data2 {
    Data3 data3;
}

class Data3 {
    String str;
}


class MyForm extends Form{
    public MyForm(id, model){
        super(id, model);
        this.add(new MyPanel(id2, new
CompoundPropertyModel(this.getModelObject().getData2());
    }
}

and very simillar in MyPanel with data3 object, but...

I have problem with updating my data model wicket always throw
WickedMessage:

Attempted to set property value on a null object.

Do anyone know how to solve this?

Thanks for help
Jan Ferko



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

Reply via email to