[Seaside] What's the difference and why??

Rick Flower rickf at ca-flower.com
Mon Feb 27 21:51:51 UTC 2006

Brian Brown wrote:
> Hi Rick - let's step back for a sec and talk about a different 
> structure....
Yea.. I was hoping someone might give me an idea of a better way to 
proceed!  Thanks!
> What *I* do, and others may have different patterns for their seaside 
> apps, is to create a main page component, and #call: (this is 
> Smalltalk notation for denoting a message send, or a method call in 
> C++ parlance) the components that I want to show up on the page. So, 
> as a simple example, you might have an initialize method:
> initialize
>     mainPage := MainPage new.
>     aboutPage := AboutPage new.
>     enrollPage := EnrollPage new.
>     contactPage := ContactPage new.
>     menuArea := MenuArea on: self.
> mainPage, aboutPage etc. are instance variables on your main App class 
> - say MyWebApp, where the initialize is located.
That makes sense and I was thinking about doing something like that so I 
wouldn't need to instantiate new instances of each
class on the fly..
> Then, in MyWebApp>>renderContentOn:
> renderContentOn: html
>     html divClass: 'sidebar' with: [html render: menuArea].
>     html divClass: 'contentarea' with: [html render: mainPage].
> Then in MenuArea class, you would have a class side method like:
> on: aComponent
>     ^ (self new) parent: aComponent
Ahh.. When might I ask does this get invoked?  Is this part of object 
instantiation when the above
"html render: menuArea" gets rendered?

> renderContentOn: html
>     html unorderedList: [
>            html listItem: [html anchorWithAction: [self parent 
> clearAllDelegates] text: 'Home'.].
>            html listItem: [html anchorWithAction: [self parent 
> mainPage call: self parent aboutPage] text: 'About'.].
>           html listItem: [html anchorWithAction: [self mainPage call: 
> self parent call enrollPage] text: 'Enroll'.].
>            html listItem: [html anchorWithAction: [self mainPage call: 
> self parent call contactPage] text: 'Contact Us'.].
>    ].
Do you mind if I ask what "clearAllDelegates" does?  I found that it is 
part of Seaside, but didn't see anything that
really explains what its for..
> This means that you have to have accessor method for the instance 
> variables that get initialized on the MyWebApp class so that you can 
> call "self parent enrollPage" from the MenuArea component. You could 
> also create convenience methods on your menu page, like: 
Thanks again.. I'll try this out.. I guess I've never gotten into 
writing web pages in true OO before and am having a hard time
of it..

-- Rick

More information about the Seaside mailing list