I find this extremely ugly..
And totallly unreadable, i really had to think about this one. My first reaction was that won't work
But then i though ahh 2.0 so first you go to the init model.. getting the model from the parent
and then quickly set that model (which is then a Inheritable) as the root of the compound and setting
that compound again as the real model..

setmodel(new CompoundPropertyModel( getModel()));

hacky hacky.. And if you show that to an average wicket programmer he will not understand that at all.

i like it to be a bit more expliciet

Person person = new Person();
Form form=new Form(new CompoundPropertyModel(person));

new AddressEditor(form, "address", person.getAddress());

public AddressEditor(parent, id, Address address) {
   super(parent, id);
   setmodel(new CompoundPropertyModel(address));

much more readable and everybody exactly knows that the address panel really has.
And you don't depend on the parent that it just gives you something. Compile time it is save.

johan


On 9/19/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:

Person person = new Person();

CompoundPropertyModel personModel = new CompoundPropertyModel(person);
Component parent = new Component("personPanel", personModel);
Component child = new Component("addressPanel", new CompoundPropertyModel(new PropertyModel("address", personModel)));

i dont think this is bloated. the above exact code is sure, but when it plays out in components its not at all. the exact same chain can be created like this in 2.0

Form form=new Form(new CompoundPropertyModel(new Person());

new AddressEditor(form, "address");

the trick in 2.0 is ...
public AddressEditor(parent, id) {
   super(parent, id);
   setmodel(new CompoundPropertyModel(getModel()));
...


so in the above the chain is created for you and works like expected because getModel() in the constructor returns a compoundpropertymodel's "assigned" version that basically works like a property model for the "address" prop. so i dont think this situation is a result of bloated code at all, the compound->property->compound->property will be a common usecase imho.

-Igor


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to