Re: Decoaring ToManyList

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Jul 30 2010 - 13:05:56 UTC


I wouldn't be surprised if this odd collection (LazyList) was created
by Struts developers to begin with.

While you may try decorating Cayenne relationship lists, I would
simply use a collection of Strings to deal with Struts, and convert it
from/to Cayenne objects on request/response. On a few projects where I
used Struts, this is exactly what I did to deal with its unfriendly
lifecycle and taglibs.

Andrus

On Jul 30, 2010, at 11:08 AM, Gary Jarrel wrote:
> On Fri, Jul 30, 2010 at 5:08 PM, Andrus Adamchik <andru..bjectstyle.org
> > wrote:
>> Hi Gary,
>>
>> So what is the function of a decorator list in this case?
>>
>
> I'd like to be able to add a number of items to a relationship via a
> web framework such as Struts2. I have an arbitrary number of products
> that can form part of the campaign. Each is represented by a field
> within the form. When Struts2 submits the form it basically calls:
> campaign.getProducts().get(0).setName("Product 1"),
> campaign.getProducts().get(1).setName("Product 2") and so on and so
> forth.
>
> I can not for tell the number of products that will form part of the
> campaign as the form is modified dynamically by jQuery in the browser.
>
> So when a new campaign object is being created the list returned for
> getProducts is empty so naturally it needs to grow as the submitted
> parameters are processed, and since struts does not seem to use a
> getProducts.add method but accesses the list by indexes, I though
> perhaps using a LazyList.
>
> I know that this example is convoluted I am unfortunately working with
> somebody else code on the front end.
>
> Gary
>



This archive was generated by hypermail 2.0.0 : Fri Jul 30 2010 - 13:06:32 UTC