how i read his mail is a bit different
Does he reallyv do it with a inner model?

i think he does this:

AddressEditor(..., Address address) {
  super(...)
   setModel(new CompoundPropertyModel(address));

and address i get from person that is in a CompoundPropertyModel of the addresseditors parent..

And i think the fix you propose still doesn't work. Because we still get 2 copies somewhere of Address object don't we?
Because 2 times a clone will happen first in the Parent person panel and a second time in the AddressEditor panel itself
So the link will be gone or i am missing something?.

The only thing i can think of is not making a clone. But trying to read in all the fields of the object that is inside the Model
(we have to know what that object is then i am affraid so we can only do this for know? models)
So that Address object inside the CompoundPropertyModel will be completely read in by getting all the fields of that address object
(that we can do with the current clone)
But when returning we don't just set the cloned model. We try to reset all the fields of the current object with the cloned object fields.

Hmm when typing this i come to the conclusion that this still doesn't work :(
(Person object will be reset with its fields so it gets a cloned Address fields and then it is again out of sync.)

Maybe your trick can work (going to the original model that is shared by all panels)
and clone that one. But that can only happen once (for all the panels for that page version) how are we going to know/do that?
And how are we going to set that back in? we can't say then component.setModel()
because it is an internal Model of more real models...






On 9/16/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
no, this is not what he means. i have these types of panels all the time in my app as well, it works like this

AddressEditor(..., IModel addressModel) {
  super(...)
   setModel(new CompoundPropertyModel(addressModel));

that setmodel is what breaks things. you wrap the model you get in a compoundpropertymodel so that your children can inherit.

so usually the model chain is like this

C1=CompoundPropertyModel(Person)
P=PropertyModel(C1, "address") <== this is the input to AddressEditor panel
C2=CompoundPropertyModel(P) <== AdressEditor wrapper

so the problem with this is that now ModelChange:79 will fail because C2!=C1

hope this clears some up, im gonna go pass out now for a while

-Igor




On 9/16/06, Eelco Hillenius < [EMAIL PROTECTED]> wrote:
public class AddressPanel extends Panel {

  public AddressPanel(MarkupContainer parent, String id,
IModel<Address> AddressModel) {
     ...
  }

new AddressPanel(this, "ap", new AddressModel(employeeModel));

new AddressPanel(this, "ap", new AddressModel(employerModel));

And all the other variations you may think of. In Wicket 1.x we don't
have strongly typed models (IModel<Type>), but you can force typing in
other ways if you want.

Basically, the point here is that you can nest IModel instances too.
As long as you do that, back button support should be fine.

Eelco


On 9/16/06, Erik Brakkee < [EMAIL PROTECTED]> wrote:
> Hi,
>
>
>  I am interesting in writing components for editing domain objects. An
> example of such an object is Employee which has and Address and several
> other attributes. Also, I have Employer, which also has an Address. Now, if
> I want to create a component for an address that provide a part of the form,
> then I would like to be able to write it independent of whether it is the
> Employer's address or the Employee's address. In other words, I want to see
> an HTML template of the form:
>
>       <tr> <td>Streeet:</td><td><input wicket:id="street"
> type="text"/></td></tr>
>       .... other fields in a similar way...
>
>  In other words, I don't want to write wicket:id="address.street" because
> that would mean that the Address always has to be obtained from a model
> object using getAddress(). In other words, I would lose the ability to edit
> an address on its own or edit addresses that are retrieved by a different
> getter.
>
>  A first solution to solve this is to construct my own AddresPanel (extends
> Panel) with a reference to an Address object. The panel also creates its own
> CompoundPropertyModel based on the address. I tried this, and it works, but
> then again, back button support will be broken because when an old version
> of the page is requested, the CompoundPropertyModel of the Employer/Employee
> and Address will have different objects since they made their own copies.
>
>  It there a way in wicket 1 to share models? I was looking through the
> wicket 2 code and there seems to be something about shared models there. So
> what would be the wicket 1 way and what would be the wicket 2 way for doing
> this properly?
>
>  Cheers
>    Erik
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to