The intent is to display a wait spinner icon while the server is preparing the file for download. In my use case I am generating a large report, this takes some time server-side before the browser's Download / Save As prompt gets invoked. I can show the wait spinner no problem, but am having trouble finding a way to clear it.
Current relevant code:
<h:commandButton id="generate" value="Generate Report" type="submit" 
    action="#{bean.generateReport()}" 
    onclick="#{rich:component('waitIcon')}.start();"/>
<a4j:status id="waitIcon">
     <f:facet name="start">
       <h:graphicImage value="/images/ai.gif" alt="ai" />
    </f:facet>
</a4j:status>
Where bean.generateReport() is an action that takes 1-10secs serverside, then spits back a download response.
This is using richfaces a4j:status indicator, as it gives useful API like .start() and .stop() but it could just as well be any dom element and setting visibility. The problem is I can't get the right event to hook on. I need to capture something like onresponsereceived...
Solutions I've tried:
Using a4j:commandButton offers an oncomplete event, but the button generates an AJAX request, which is incapable of starting the download.  (See h:command button oncomplete action) 
Using a window.timeout function to call .stop() on the component.  This works on a functional level, but since the generation time swings pretty wildly between 1-10 secs, it makes the indicator kind of not reflecting reality.
Anyone have any good ideas on handling this?
 
     
     
     
    