Hello!
Some of my more complex views contain a hierarchy of components, each component taking care of some small part of UI logic. This view is implemented as a container component which delegates rendering to several sub-components. From outside, this view looks like an ordinary WAComponent. Everything goo so far. A small problem arises when such component tries to #call: another component. Since technically it is usually the inner component sending #call: to self, the new view doesn't replace the whole hierarchy, but only the inner component that actually sent #call:, which is not fine in this case.
What am I doing now, is sending each inner component a reference to its container component and then the inner object sends #call: to its container instead of self. I find it ugly, need to elaborate why? Is there a better solution?
A similar problem arises with #answer -- you cannot #answer from an inner component because it wasn't the one which wall #call-ed in the first place. Again I need a reference to a container component to #answer from there.
Milan Mimica http://sparklet.sf.net _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I don't have a good answer but I generally use announcements in that situation.
RS Date: Sat, 4 Feb 2012 18:12:34 +0100 From: [hidden email] To: [hidden email] Subject: [Seaside] multiple components Hello! Some of my more complex views contain a hierarchy of components, each component taking care of some small part of UI logic. This view is implemented as a container component which delegates rendering to several sub-components. From outside, this view looks like an ordinary WAComponent. Everything goo so far. A small problem arises when such component tries to #call: another component. Since technically it is usually the inner component sending #call: to self, the new view doesn't replace the whole hierarchy, but only the inner component that actually sent #call:, which is not fine in this case.
What am I doing now, is sending each inner component a reference to its container component and then the inner object sends #call: to its container instead of self. I find it ugly, need to elaborate why? Is there a better solution?
A similar problem arises with #answer -- you cannot #answer from an inner component because it wasn't the one which wall #call-ed in the first place. Again I need a reference to a container component to #answer from there.
Milan Mimica http://sparklet.sf.net _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by mmimica
For the #call: sites, I don't know any other way than passing the reference to the container.
But for the #answer: sites, your container component can intercept subcomponents answers [1]. You can use that to propagate an answer from a subcomponent as the answer of the container component. [1] http://book.seaside.st/book/components/embedding/intercepting-answer On 04 Feb 2012, at 18:12, Milan Mimica wrote: > Hello! > > Some of my more complex views contain a hierarchy of components, each component taking care of some small part of UI logic. This view is implemented as a container component which delegates rendering to several sub-components. From outside, this view looks like an ordinary WAComponent. Everything goo so far. A small problem arises when such component tries to #call: another component. Since technically it is usually the inner component sending #call: to self, the new view doesn't replace the whole hierarchy, but only the inner component that actually sent #call:, which is not fine in this case. > What am I doing now, is sending each inner component a reference to its container component and then the inner object sends #call: to its container instead of self. I find it ugly, need to elaborate why? Is there a better solution? > > A similar problem arises with #answer -- you cannot #answer from an inner component because it wasn't the one which wall #call-ed in the first place. Again I need a reference to a container component to #answer from there. > > > -- > Milan Mimica > http://sparklet.sf.net > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Robert Sirois
On 4 February 2012 21:44, Robert Sirois <[hidden email]> wrote:
Yes, I think it's about time I take a look at announcements too.
This answer pretty much summarizes it: http://stackoverflow.com/a/7980099/514306 Milan Mimica http://sparklet.sf.net _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |