Thanks guys. I am trying to avoid javascript and to do this with tapestry components, so the ProgressiveDisplay method that François suggested seems perfect. A bit of fiddling and it's working perfectly. For the record, and for future searchers, here is the code that I used:
>From the tml: <t:actionlink t:id="toggleDomains" zone="domainsZone">Domains</t:actionlink> <t:zone t:id="domainsZone"> <t:if test="domainsVisible"> <t:progressivedisplay t:id="domainLoadingIndicator" update="show"/> <t:block t:id="domainsBlock"> <t:grid source="domains" rowsPerPage="15"/> </t:block> </t:if> </t:zone> >From the page class: @Persist @Property private boolean domainsVisible; @SetupRender void initialize() { domainsVisible = false; } @InjectComponent private Zone domainsZone; @Inject private Block domainsBlock; Zone onActionFromToggleDomains(){ domainsVisible = domainsVisible ? false : true; return domainsZone; } Block onProgressiveDisplayFromDomainLoadingIndicator(){ return domainsBlock; } public List<Domain> getDomains() { if(domainsVisible){ return retrieveDomainList(); } else { return null; } } David On Friday, 15 April 2011 at 8:31 PM, François Facon wrote: > Use ProgressiveDisplay component? > http://tapestry.apache.org/tapestry5.1/tapestry-core/ref/org/apache/tapestry5/corelib/components/ProgressiveDisplay.html > > see example > http://lombok.demon.co.uk/tapestry5Demo/test/core/progressivedisplaydemosource > > or from tapestry test case > http://tapestry-test.appspot.com/progressivedemo > with the related src at > http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ProgressiveDemo.java?view=markup > > François > > > 2011/4/15 David Woods <dwood...@gmail.com>: > > Hi, I'm just getting started with Tapestry5, and very impressed so far. > > > > I have a zone on my page containing a grid component that takes about 20 > > seconds to calculate the contents of. I don't want the loading of the page > > to hang while this occurs, so I initially have the contents of the zone > > hidden by an "if" component associated with a boolean property for the > > visibility, and have the "get" method for the grid contents conditionally > > returning null when the property is set to false. To calculate the contents > > and display the zone I have an actionlink that changes the boolean property > > and returns the zone body. > > > > The toggling works fine, but what I would like to do is display a message on > > the page as soon as the actionlink is clicked saying that the load is in > > progress (at the moment there is no visible change for 20s), and then this > > message should go away when the zone appears. Is there a way to do this? > > Also, I would appreciate any insights into whether there is a better way to > > do this... > > > > From the tml: > > > > <t:actionlink t:id="toggleDomains" > > zone="domainsZone">Domains</t:actionlink> > > > > <t:zone t:id="domainsZone"> > > > > <t:if test="domainsVisible"> > > > > <t:grid source="domains" rowsPerPage="15"/> > > > > </t:if> > > > > </t:zone> > > > > > > From the page class: > > > > > > @Persist > > > > @Property > > > > private boolean domainsVisible; > > > > > > > > @InjectComponent > > > > private Zone domainsZone; > > > > > > > > Zone onActionFromToggleDomains() { > > > > domainsVisible = domainsVisible ? false : true; > > > > return domainsZone; > > > > } > > > > > > > > public List<Domain> getDomains() { > > > > if(domainsVisible) { > > > > return retrieveDomainList(); > > > > } > > > > else { > > > > return null; > > > > } > > > > } > > > > > > Thanks for all the interesting discussion and tips. > > > > > > David > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org >