rendering in a class hierarchy, part 2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

rendering in a class hierarchy, part 2

Stephan Eggermont-3
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


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside