i try to look at this this weekend, but i have a quick question
I find it a bit verbose can't it be a bit shorter like this (just an
example)

SharedPropertyModel<Customer> model = new
SharedPropertyModel<Customer>(customer);
this.setModel(model);

FormComponent firstName = new CustomerNameField("firstName",
model.getFirstName()).setRequired(true);
add(firstName);

where getFirstName() returns the model

johan




On Feb 6, 2008 6:57 PM, Scott Swank <[EMAIL PROTECTED]> wrote:

> One of our more clever developers created a CompoundPropertyModel that
> uses a cglib proxy to strongly bind the mutators to the model.  It
> looks like this:
>
>                SharedPropertyModel<Customer> model = new
> SharedPropertyModel<Customer>(customer);
>                this.setModel(model);
>
>                FormComponent firstName = new
> CustomerNameField("firstName").setRequired(true);
>                model.bind(firstName).to().getFirstName();
>                add(firstName);
>
>                FormComponent lastName = new
> CustomerNameField("lastName").setRequired(true);
>                model.bind(lastName).to().getLastName();
>                add(lastName);
>
>                FormComponent addr1 = new
> AddressField("address1").setRequired(true);
>                model.bind(addr1).to().getAddress().getAddress1();
>                add(addr1);
>
>                FormComponent addr2 = new AddressField("address2");
>                model.bind(addr2).to().getAddress().getAddress2();
>                add(addr2);
>
>                FormComponent city = new CityField("city");
>                model.bind(city).to().getAddress().getCity();
>                add(city);
>
> We're happy to share if folk like this approach.  N.B. that the .to()
> call is for readability rather than out of any necessity.
>
> Cheers,
> Scott
>
> --
> Scott Swank
> reformed mathematician
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to