[Seaside] Re: Modal dialogs that appear with their "background"
Stephan Eggermont
stephan at stack.nl
Sat Jun 7 08:24:09 UTC 2014
EstebanAM wrote:
>I normally find/feel QCMagritte has a lot of things I could use, but
>with scarce documentation it is really difficult to me to know where
>to start with.
Good point. We'll try to put something together.
>Would you provide a simple example of how to replace #call:/show: with
>announcements?
In the meantime you can take a look at StoryBoard, that does exactly the same
but then with Deltawerken.
That is exactly what the pagechoice components do. they have a collection of pages they
can show and switch when sent an announcement.
When initializing a component, we define the announcements that it should react to
by showing something different. In the homepage of storyboard, we by default
show the SBProjectOverview. SBProjectOverview has a method that announces
SBProjectTonen (show project), that will result in an SBProjectDashboard being
shown on a project.
In SBHomePage (a subclass of DEPagechoice) we have
SBHomePage>>initialize
super initialize.
self homepage: SBProjectOverview new;
goHomeOn: SBProjectOverviewTonen;
goHomeOn: DELoggedIn;
yourself.
self addPage: SBProjectStoryBoard new
announcement: SBProjectTonen
symbol: #project.
self addPage: SBProjectTeamPage new
announcement: SBProjectTeamWijzigen
symbol: #project.
self addPage: SBProjectDashboard new
announcement: SBProjectDashboardTonen
symbol: #project.
self addPage: SBUsersView new
announcement: SBBeheerTonen
so that reacts to
SBProjectOverviewTonen, DELoggedIn, SBProjectTonen,
SBProjectTeamWijzigen, SBProjectDashboardTonen and
SBBeheerTonen.
By showing a different component.
To make that work, we have
DEPageChoice>>goHomeOn: announcement
self announcer
subscribe: announcement
do: [ :ann | self currentPage: homepage ]
DEPageChoice>>addPage: page announcement: announcement symbol: aSymbol
self addPage: page.
self announcer
subscribe: announcement
do: [ :ann |
(ann perform: aSymbol) ifNotNil: [ page subject: (ann perform: aSymbol) ].
self currentPage: page]
DEPageChoice>>addPage: page announcement: announcement
self addPage: page.
self announcer
subscribe: announcement
do: [ :ann |
self currentPage: page.
]
DEPageChoice>>addPage: page
self pages
detect: [ :each | each = page ]
ifNone: [ self pages add: page ].
currentPage ifNil: [ currentPage := page ].
^page
DEPageChoice>>renderContentOn: canvas
currentPage
ifNil: [ canvas text: 'Internal error in ', self class name ,': no current page set.' ]
ifNotNil: [ canvas render: currentPage ]
The announcer comes from the superclass of DEPageChoice, DEComponent
DEComponent>>announcer
^self session announcer
To make that work you need a session with an Announcer
DESession>>announcer
^announcer ifNil: [ announcer := Announcer new ]
The project overview can then do the announcement to make the
homepage switch what page it shows.
SBProjectOverview>>showProject: aProject
self announce: (SBProjectTonen on: aProject)
SBProjectOverview >>showBeheer
((self user class = SBAdministrator ) and: [self isLoggedIn]) ifTrue: [
self announce: SBBeheerTonen]
More information about the seaside
mailing list