[Seaside] rendering in a class hierarchy, part 2
Stephan Eggermont
stephan at stack.nl
Sun Nov 8 13:58:37 UTC 2009
Using Announcements could use some extra detailed explanations:
Create an Announcement subclass
SomethingInterestingHappenedOnDefaultDisplay
Create a subclass of WASession having an announcer instance variable
and lazy initialized getter
MySession:announcer
^announcer ifNil: [announcer := Announcer new]
This announcer handles the session specific announcements. You might
have
an application one to handle session-to-session announcements, or
component specific ones to handle very complex interactions.
In MADefaultDetailDisplay, you create a method:
somethingInterestingHappened
self session announcer announce:
SomethingInterestingHappenedOnDefaultDisplay
that you calll somewhere in the component, e.g.:
renderContentOn: html
html form: [
html submitButton
on: #somethingInterestingHappened of: self]
In your page you subscribe in initialize to this Announcement:
initialize
super initialize.
details := MADefaultDetailDisplay new.
self subscribeToDetails
subscribeToDetails
self session announcer
subscribe: SomethingInterestingHappenedOnDefaultDisplay
send: #switchToOtherDetail to: self
" add handling other details"
switchToOtherDetail
detail := MAOtherDetailDisplay new.
Stephan Eggermont
More information about the seaside
mailing list