[Seaside] WAPresenter>>states

Philippe Marschall philippe.marschall at gmail.com
Sat Nov 29 10:31:41 UTC 2008


2008/11/28, Eric Hochmeister <erichochmeister at gmail.com>:
> Philippe,
>
>> Only the things returned by #states are backtracked.
>
> So by default, nothing is backtracked on a new component.  Since
> #states by default returns an empty collection.
>
>> If your children
>> change over time, backtracking needs to happen somehow which means you
>> have to implement #states at some place. Where and how depends very
>> much of your situation. If you store all your children in and
>> OrderedCollection then only backtracking those will suffice. However
>> if your #children looks something like:
>>
>> children
>>    ^Array with: firstComponen with: secondComponent
>>
>> then you probably need to backtrack the component itself.
>
> Sorry, just to try and figure out the difference between
> OrderedCollection and Array above, I'm guessing in your above
> paragraph you're describing the instance where components are stored
> within an OrderedCollection on an instance variable which is returned
> by "children" rather than having children generate a new instance of a
> Collection containing components everytime?  Is this correct? (ie.
> children ^myChildren, where myChildren is an OrderedCollection
> containing the components)
>
> If not, I'm not sure I see the difference in children returning an
> Array or OrderedCollection.
> children
> ^ Array with:a with:b
> and
> children
> ^ OrderedCollection with:a with:b

Right. If you use it like this, then there is no difference. What I
implicitly meant the following usage pattern:

You store your children in an OrderedCollection, you reference that
OrderedCollection in an instance variable of your component and you
modify that OrderedCollection but never the instance variable.

In this case you could just return and array (or any Collection) with
the OrderedCollection in #states. You can't return the
OrderedCollection itself because you want the OrderedCollection to be
backtracked.

Did this make sense or confuse only more?

Cheers
Philippe


More information about the seaside mailing list