On 9/16/06, Johan Compagner <[EMAIL PROTECTED] > wrote:
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));

if you do the above then we cannot do much, maintaining object identity would require some serious hackery because in this case the object can be a property of any other object nested x levels deep. so i dont think we should support this usecase. what we should support is model chaining because it is such a common usecase.
 

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...



well, see what happens is that you wouldnt clone the model itself. if you encounter that the model is chaining to a model somewhere higher then what you would write replace it with a locator and its old value- so when deserializing you relink to it and push the old object. will that work? im not sure. that means modelchange has to keep the bytearray instead of the clone so on undo you deserialize.

and im sure there can be plenty cases where it wont work.

why would we need to keep track of what we already cloned and not cloned? we would do it for every model that was changed.

-Igor

 

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



-------------------------------------------------------------------------
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