Re: [Wicket-user] Ajax component replacement with updated Model issue

2007-07-18 Thread Timo Rantalaiho
On Sun, 15 Jul 2007, Erik Dreyer wrote:
 Everything is working great except the 'display' component is not reflecting
 the saved changes.  Before replacing the edit component
 with the display component, I'm calling setModel() on the original display
 component with the updated data.  This has no effect visible effect.

I saw that you already solved this by calling onModelChanged().
I think that if you use setModelObject() it does that call so
you don't need to call it explicitly. You could also see if
just using the same model instance for both edit and display 
component would do the trick. The equals() implementation of
the model object might also affect the behavior, because as far
as I remember the onModelChange-things get triggered only when
!newModelObject.equals(oldModelObject).

 The 'display' component is itself a tree of components.  Is there a
 prescribed way to propogate the fact that I updated the model down
 to all the affected child components?  Is that something I have to handle
 myself or does the framework do that?

I think that sharing the model is a common trick. Note that 
you can also nest models, if you e.g. need CompoundPropertyModel
handling the same data that is in another kind of IModel
elsewhere.

- Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] Ajax component replacement with updated Model issue

2007-07-15 Thread Erik Dreyer

Hi,

Here's a use case I'm having a bit of trouble with:

1) present user with a Panel that display Contact information as text
('display' component).
2) User chooses to edit info
3) Replace 'display' component (via Ajax) with an 'edit' component.
4) User saves changes (via Ajax form post).
5) Part of the form post processing is to restore the original 'display'
component with an updated Model.

Everything is working great except the 'display' component is not reflecting
the saved changes.  Before replacing the edit component
with the display component, I'm calling setModel() on the original display
component with the updated data.  This has no effect visible effect.

The 'display' component is itself a tree of components.  Is there a
prescribed way to propogate the fact that I updated the model down
to all the affected child components?  Is that something I have to handle
myself or does the framework do that?

Thanks,
Erik
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Ajax component replacement with updated Model issue

2007-07-15 Thread Erik Dreyer

Solved it.

onModelChanged() is your friend.
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user