[Seaside] Re: Modal dialogs that appear with their "background"

Iwan Vosloo iwan at reahl.org
Thu Jun 5 06:15:09 UTC 2014


On 04/06/2014 17:29, Stephan Eggermont wrote:
> Is there a specific reason you don't want to use a WAComponent subclass to do this?

Stephan,

Any solution should do, as long as we can call a method that blocks and 
returns with the answer. I did try with a WAComponent also that embeds 
the current component, but with similar results.

I will have a look at your code as mentioned in your other email too. In 
the mean time, I have come up with something that works. Not sure how 
idiomatic this is of seaside though:

WAComponent subclass: #DialogHolder                   "An empty 
component that can be replaced by the dialog later"


WADecoration subclass: #DialogDecoration            "A Decoration that 
adds a DialogHolder to its decoratedComponent"
     instanceVariableNames: 'holder'

DialogDecoration>>initialize
     super initialize.
     holder := DialogHolder new

DialogDecoration>>renderContentOn: html
     html render: holder.
     self renderNextOn: html

DialogDecoration>>holder
     ^ holder

Then, the method that makes it appear, on a WAComponent subclass:

ask: aString
     | dialog answer |
     dialog := DialogDecoration new.
     self session presenter addDecoration: dialog.
     answer := dialog holder
         call:
             (WAYesOrNoDialog new
                 addMessage: aString;
                 yourself).
     self session presenter removeDecoration: dialog
     ^answer

Regards
- Iwan



More information about the seaside mailing list