[Seaside] Design (was Re: [Seaside] Web Calendar for Seaside)

Derek Brans seaside@lists.squeakfoundation.org
Sun, 24 Nov 2002 10:55:26 -0800


Hi Adrienne,
I've taken a stab at some of the questions.  See below.  Someone will 
correct me if I'm wrong.
Regards,
Derek

On Sunday, November 24, 2002, at 07:30 AM, Adrian Lienhard wrote:

> Hi Avi and all other Seasiders!
>
> More tutorials: This would be really good: Helping beginners to have a
> smooth start and providing the advanced developers with helpful 
> experience
> (e.g.  "patterns" for common problems).
>
> At the moment I'm facing some of the following questions which I'd like 
> to
> have some advice or discussion on:
>
> Domainmodel:
> How do you best access the domainmodel. Important seems to me to have 
> the
> model separated from presentation as much as possible. To access the 
> model I
> use the Session as following: It has a Classvar DomainModel and 
> implements:
> MySession>>domainmodel which returns the unique instance. So in the 
> Seaside
> code I use: "session domainmodel ...".
> Now there is the question of let each Component access the model like 
> that
> or just let the root Component wich passes parts of the model to the 
> child
> Components. For example:
>
> MyCompoundViewComponent>>initlialize
> tasklistview := MyTaskListView new
>       tasks: session domainmodel tasks.
>
> and then
> MyCompoundViewComponent>>renderOn: html
> ...
> tasklistview renderOn: html.
> ...
>

That is correct.  As I've recently learned: store the domain model in 
the session.  Feel free to subclass Session to accomplish this.  Any 
subclass of component has access to the current session.


> This leads to the second issue:
> In the "CompoundView"-Component - a Component wich puts several others 
> (like
> Menu, Main-View etc.) together - I use instance vars to store the sub
> components. This makes them having state (e.g. for storing if a toolbar 
> is
> open or closed etc.).

This sounds right.  Note:  A component should store other components and 
not views in its instance variables.  Views are intended to be used once 
and then thrown away.  See a previous posting by Avi in this thread.

> But now, I'd like to call other Compponents from the sub components but 
> just
> substituting the calling and not all. This means for example that "self
> call: CreateNewTask new" should show a page *with* the menu... How could
> this be done without much trouble?
>

Try this:
store the content component (the subComponent  that displays the content 
you want to change) in the session.
Then, rewrite call: in your menu subComponent as something like:
MySubComponent>>call: aPage
	^ session contentComponent call: aPage

This reminds of using <base target="someFrame"> in an html frame.

Hope that helps,
Derek





Nerd on a Wire: Web and Information Solutions
Website Design - Database Systems - Site Hosting
604.874.6463
mailto:info@nerdonawire.com
For more information, visit http://nerdonawire.com