[Seaside] Upgrading to 2.5a-avi.3

Avi Bryant avi at beta4.com
Sat Apr 17 10:04:46 CEST 2004


On Apr 17, 2004, at 12:14 AM, Colin Curtin wrote:

> Avi Bryant wrote:
>
>>
>> However, I'm considering deprecating #activeComponent, since 
>> #visiblePresentersDo: is probably better for most purposes.  What are 
>> you using it for?
>
> Essentially type checking to see if I should display some additional 
> features. For example:
> (self activeComponent currentGallery) = self rootGallery
>        ifTrue: [
>            html divNamed: 'random_images' with: [ self 
> renderRandomImagesOn: html ].
>            html divNamed: 'latest_images' with: [ self 
> renderLatestImagesOn: html ].
>        ].

Hm, there's something odd there.  If you're inside the render method of 
a component, it must be visible - and #activeComponent on a visible 
presenter will always return self.  Is there something unusual in your 
component structure?

Anyway, the Seaside 2.5 idiom for this would probably be to iterate 
through the visible presenters and see if any of them matched the 
rootGallery, rather than checking the #activeComponent specifically.  
In most cases it's the same thing, but it's a little more flexible that 
way.  That means I should probably add #visiblePresenters as well as 
#visiblePresentersDo:, to make it easier to send #detect: etc.

> There are better ways to do this, but this is convenient for now. I'm 
> still trying to learn how Presenters, Components, and Decorations work 
> together.

Not surprising, since they're not documented yet ;).  See my recent 
message to Sam in this thread for a little bit of info.  More to come.

Avi



More information about the Seaside mailing list