[Seaside] Un-calling components

Ramon Leon ramon.leon at allresnet.com
Wed Aug 22 07:16:31 UTC 2007


> In our application, we have sidebar and main content 
> components that are rendered side-by-side. A kinda awkward 
> issue arises when the main component #call's another -- if 
> the user selects a link in the sidebar, any changes the 
> sidebar makes to the view state of the main component aren't 
> seen by the user (the main component is still decorated, and 
> so the #call'ed component is rendered).
> 
> To solve it, we added a decoration to the sidebar component, 
> with the following method:
> 
> processChildCallbacks: aStream
> 	"If the user clicks on a link in the sidebar, un-#call 
> the main content component if it has been #call'ed"
> 	(aStream callbacks contents anySatisfy: [:callback |
> 		(aStream request fields includesKey: callback key)
> 			and: [callback owner = self owner]])
> 		ifTrue: [
> 			| dec |
> 			dec := self owner parent decoration.
> 			dec isDecoration ifTrue: [dec remove]].
> 	^ super processChildCallbacks: aStream
> 
> We also had to add #callbacks and #request methods to 
> WACallbackStream. (Note that we don't want the callee to 
> #answer: -- we just ignore the fact that it was ever called 
> in the first place.)
> 
> I'm curious as to whether there's a better way of doing what 
> we're trying to accomplish? Or has anyone else ever needed 
> something along these lines?

I believe you can simply tell any component #home to remove all decorations.
Your sidebar could just do its thing and then call main home.  Maybe I
misunderstand your intentions?

Ramon Leon
http://onsmalltalk.com



More information about the seaside mailing list