Panel and Model inside of a wizard

2010-01-19 Thread Jeffrey Schneller
I am trying to figure out why a panel in a step of my wizard is not
showing the correct data after an Ajax call.  The step contains a
re-usable panel (TotalPanel) for displaying information from the wizard
that is backing the model.The problem is the values in the
TotalPanel never reflect the values that have been updated via the Ajax
call.  I know everything should work because if I change the TotalPanel
to take the entire model then everything works.  The problem being, I
only want my TotalPanel to need to take an Estimate and not the
CheckoutModel.

 

At the wizard level I have:

CheckoutModel bean = new
CheckoutModel();

CompoundPropertyModelCheckoutModel
myModel = new CompoundPropertyModelCheckoutModel(bean);

setDefaultModel(myModel);

 

On the step of the wizard that I want to display my re-usable panel I
have:

 

final TotalPanel totalPanel = new
TotalPanel(total_panel, new
CompoundPropertyModel(model.getObject().getEstimate()));

totalPanel.setOutputMarkupId(true);

add(totalPanel);

 

btw... Estimate is a property of the CheckoutModel.

 

 

Thanks.



Re: Panel and Model inside of a wizard

2010-01-19 Thread Sven Meier

Hi Jeffrey,


new CompoundPropertyModel(model.getObject().getEstimate())


this doesn't look good, does the estimate object change its values or is it 
replaced by another object after an AJAX request?

Sven


Jeffrey Schneller wrote:

I am trying to figure out why a panel in a step of my wizard is not
showing the correct data after an Ajax call.  The step contains a
re-usable panel (TotalPanel) for displaying information from the wizard
that is backing the model.The problem is the values in the
TotalPanel never reflect the values that have been updated via the Ajax
call.  I know everything should work because if I change the TotalPanel
to take the entire model then everything works.  The problem being, I
only want my TotalPanel to need to take an Estimate and not the
CheckoutModel.

 


At the wizard level I have:

CheckoutModel bean = new
CheckoutModel();

CompoundPropertyModelCheckoutModel
myModel = new CompoundPropertyModelCheckoutModel(bean);

setDefaultModel(myModel);

 


On the step of the wizard that I want to display my re-usable panel I
have:

 


final TotalPanel totalPanel = new
TotalPanel(total_panel, new
CompoundPropertyModel(model.getObject().getEstimate()));

totalPanel.setOutputMarkupId(true);

add(totalPanel);

btw... Estimate is a property of the CheckoutModel.


Thanks.


  



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



RE: Panel and Model inside of a wizard

2010-01-19 Thread Jeffrey Schneller
It does change its values.  I have since changed it to:

final TotalPanel totalPanel = new TotalPanel(total_panel, new
CompoundPropertyModel(new PropertyModel(model, estimate)));

this seems to work.  I guess I had the chaining of models wrong. 

Am I right, or is still off base?



-Original Message-
From: Sven Meier [mailto:s...@meiers.net] 
Sent: Tuesday, January 19, 2010 3:11 PM
To: users@wicket.apache.org
Subject: Re: Panel and Model inside of a wizard

Hi Jeffrey,

 new CompoundPropertyModel(model.getObject().getEstimate())

this doesn't look good, does the estimate object change its values or is
it replaced by another object after an AJAX request?

Sven


Jeffrey Schneller wrote:
 I am trying to figure out why a panel in a step of my wizard is not
 showing the correct data after an Ajax call.  The step contains a
 re-usable panel (TotalPanel) for displaying information from the
wizard
 that is backing the model.The problem is the values in the
 TotalPanel never reflect the values that have been updated via the
Ajax
 call.  I know everything should work because if I change the
TotalPanel
 to take the entire model then everything works.  The problem being, I
 only want my TotalPanel to need to take an Estimate and not the
 CheckoutModel.

  

 At the wizard level I have:

 CheckoutModel bean = new
 CheckoutModel();

 CompoundPropertyModelCheckoutModel
 myModel = new CompoundPropertyModelCheckoutModel(bean);

 setDefaultModel(myModel);

  

 On the step of the wizard that I want to display my re-usable panel I
 have:

  

 final TotalPanel totalPanel = new
 TotalPanel(total_panel, new
 CompoundPropertyModel(model.getObject().getEstimate()));

 totalPanel.setOutputMarkupId(true);

 add(totalPanel);

 btw... Estimate is a property of the CheckoutModel.


 Thanks.


   


-
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



Re: Panel and Model inside of a wizard

2010-01-19 Thread Sven Meier
If you call #getEstimate() you pull the value once out of your object 
and never again.
With PropertyModel(model, estimate) you'll always get a fresh value 
from your model.


Calling a getter  should *always* be done as late as possible.

Hope this helps

Sven


Jeffrey Schneller wrote:

It does change its values.  I have since changed it to:

final TotalPanel totalPanel = new TotalPanel(total_panel, new
CompoundPropertyModel(new PropertyModel(model, estimate)));

this seems to work.  I guess I had the chaining of models wrong. 


Am I right, or is still off base?



-Original Message-
From: Sven Meier [mailto:s...@meiers.net] 
Sent: Tuesday, January 19, 2010 3:11 PM

To: users@wicket.apache.org
Subject: Re: Panel and Model inside of a wizard

Hi Jeffrey,

  

new CompoundPropertyModel(model.getObject().getEstimate())



this doesn't look good, does the estimate object change its values or is
it replaced by another object after an AJAX request?

Sven


Jeffrey Schneller wrote:
  

I am trying to figure out why a panel in a step of my wizard is not
showing the correct data after an Ajax call.  The step contains a
re-usable panel (TotalPanel) for displaying information from the


wizard
  

that is backing the model.The problem is the values in the
TotalPanel never reflect the values that have been updated via the


Ajax
  

call.  I know everything should work because if I change the


TotalPanel
  

to take the entire model then everything works.  The problem being, I
only want my TotalPanel to need to take an Estimate and not the
CheckoutModel.

 


At the wizard level I have:

CheckoutModel bean = new
CheckoutModel();

CompoundPropertyModelCheckoutModel
myModel = new CompoundPropertyModelCheckoutModel(bean);

setDefaultModel(myModel);

 


On the step of the wizard that I want to display my re-usable panel I
have:

 


final TotalPanel totalPanel = new
TotalPanel(total_panel, new
CompoundPropertyModel(model.getObject().getEstimate()));

totalPanel.setOutputMarkupId(true);

add(totalPanel);

btw... Estimate is a property of the CheckoutModel.


Thanks.


  




-
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

  



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