[Seaside] Progress bar

Avi Bryant avi.bryant at gmail.com
Sun Mar 27 20:44:48 CEST 2005


On Sun, 27 Mar 2005 12:55:19 -0500, Daniel Salama <dsalama at user.net> wrote:
> Hi guys,
> 
> I'm testing a very lengthy process that when I trigger it from a
> browser, sometimes the browser times out (it exceeds 3 minutes). Is
> there something in Seaside I can use to show some kind of a progress
> bar that will keep the user informed of the progress of a request while
> at the same time keep refreshing the page until the process is
> completed so the browser doesn't time out?

I just committed some code that makes this pretty easy - see
http://www.squeaksource.com/Seaside/Seaside2.6a1-avi.22.mcz .

That version includes WADelayedAnswerDecoration, which when added to
any component will insert a <meta http-equiv=refresh> tag into the
document head which will, after a specified delay, trigger a send of
#answer to the component.  As a very simple example of this:

MyComponent>>doStuff
   1 to: 10 do:
       [:i |
       self call: (WAComponent new
                           addMessage: 'Step ', i asString;
                            addDecoration: (WADelayedAnswerDecoration
new delay: 1);
                             yourself]

Now, rather than just a blank WAComponent with a message added, you
would probably want a fancier and prettier progress bar, but that gets
the basic idea across.

This convenience method would make it even easier to use:

WAComponent>>call: aComponent forSeconds: aNumber
   aComponent addDecoration: (WADelayedAnswerDecoration new delay: aNumber).
    ^ self call: aComponent

Avi


More information about the Seaside mailing list