[Seaside] Re: Menu component - communicating with root component
keith_hodges at yahoo.co.uk
Sun Apr 20 17:48:10 UTC 2008
I still dont get it.
> Exactly the point, rather than just fire some generic event or symbol, you
> reify the message, the announcement as a full blown object able to carry
> both information and behavior if necessary with them. You could announce a
> block with a callback so the parent doesn't even know what the child is
> Say I keep a parent component broken up into children such as header,
> footer, menu, and body and I want the currently loaded X to be able to be
Ok so this is a component:
(headerA bodyA footerA)
And this is a second instance of this component in the same page
(headerB bodyB footerB)
> reloaded by an even triggered by Y.
So for example we want, bodyA to be updated by an event on menuItemA1.
we want, bodyB to be updated by an event on menuItemB1.
> The menu to change the body, the body
> to change the navigation, the navigation to change the body and header at
> the same time, i.e. multiple other parties interested in the event, etc. I
> could just design an event that when fired, gives me the component I want to
> talk to, as if it were a phone call where the interested party would pick
> self announce: (ReloadBody with: [:body | body call: (SomeOtherReport model:
> self model) ]).
Great, so the plan is that this event ReloadBody, when triggered will
put the correct body into the block.
I assume then that bodyB, when added, said to its annnouncer, if any
ReloadBody events come up I am able to respond. I assume this, because
in my system the parents dont know any details about their chidren, a
pier page is merely a container and can have anything put into it to any
level of depth.
So... where is this announcer, how does bodyB obtain its announcer? If
there is one global announcer, then what routes a ReloadBody to the
Correct BodyA or B.
So menuItemB, performs "self announce: (anAnnouncement)" on an announcer.
ok... where is this announcer? How does it know about it?
Is it a global or is it told about it when it was added to its parent?
ParentA says to each of its children, "your announcer is AnnouncerA."
headerB says to each of its children, headerMenuB "your announcer is
AnnouncerB." and likewise
The Menus says to each of their MenuItems, your announcer is AnnouncerB.
But all we are doing is here is replacing, child knows his parent, with
child knows his announcer, or in the case above child knows his
global-announcer. I think that first is more useful than the last two,
because last two give neither the child nor the announcer any spatial
information at all.
Ok so thats all connected and would work...
but what if there were two menus, and we want the menu to flash when an
item is selected.
For this, each Menu will need its own Announcer, and each menuItem is
given the MenuAnnouncer when it is added to the Menu...
Hang on there, each MenuItem ends up having the announcer of ifs
Parent... why not just have a reference to its parent, and ask its
parent for an announcer.
thanks in advance for any help, I am still really struggling to
understand how announcements are supposed to work in a heirarchical
system of nested components, without any spatial relationship
information at all.
More information about the seaside