[Seaside] Re: Menu component - communicating with root component

Steve Aldred aldreds at velocitynet.com.au
Sun Apr 20 03:53:07 UTC 2008

Squeaker wrote:
> ...
> Assume a situation where you have a parent (aMenu) that had multiple 
> children (like MenuItems in a menu) and each child can announce 
> ItemClicked.  Wouldn't the parent code end up looking a huge case 
> statement when trying to figure out which child was clicked?
> ...

That's the point of announcements, they are an instance of a class and 
carry whatever data you desire. If you need the instance of the menu 
item in the announcement then put it there.

I'd be inclined to then put the behaviour you want on the menu items 
themselves and the receiver of the announcement just asks the 
announcement item to process the necessary data. The menu item doesn't 
know about the data per se, it just holds the behavior to apply to the 
data when the behavior method gets invoked with the data as an argument.


More information about the seaside mailing list