setModel() and getModel() questions

2009-03-15 Thread pieter claassen
I am obviously doing something wrong here.

On my wicket pages, I am trying to set the Model with setModel()

e.g.setModel(new CompoundPropertyModel(new Treatment()));

On the components (forms, panels etc.) contained on that page, I try
to retrieve the object with getModelObject() or getInnermostModel()
but both of them return null.

eg. Treatment treatment = (Treatment) getModelObject();

The other components still function correctly in the form so they
manage to access the model properties using the CompoundPropertyModel.

What is the difference between getModelObject() and
getInnermostModel().getObject()?

Anybody have a tip on what I am doing wrong here?

Thanks,
Pieter

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



Re: setModel() and getModel() questions

2009-03-15 Thread Igor Vaynberg
make sure you are not calling these methods in the constructors -
before the components are added to the page that has the model.

-igor

On Sun, Mar 15, 2009 at 1:39 PM, pieter claassen pie...@claassen.co.uk wrote:
 I am obviously doing something wrong here.

 On my wicket pages, I am trying to set the Model with setModel()

 e.g.            setModel(new CompoundPropertyModel(new Treatment()));

 On the components (forms, panels etc.) contained on that page, I try
 to retrieve the object with getModelObject() or getInnermostModel()
 but both of them return null.

 eg. Treatment treatment = (Treatment) getModelObject();

 The other components still function correctly in the form so they
 manage to access the model properties using the CompoundPropertyModel.

 What is the difference between getModelObject() and
 getInnermostModel().getObject()?

 Anybody have a tip on what I am doing wrong here?

 Thanks,
 Pieter

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



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