Tapestry 5.1 has this lazy loading included as component: check the ProgressiveDisplay component.

Andy



Alfie Kirkpatrick schrieb:
I made a simple "LazyZone" component which ajax loads the zone after the
page load. Should be simple enough to add a timer to it. You provide a
block as a parameter to the component...

LazyZone.java
-------------
@IncludeJavaScriptLibrary("lazyZone.js")
public class LazyZone extends Zone {
        @Parameter
        private Block content;
        
        @Inject
        private ComponentResources resources;
        
        @Environmental
        private RenderSupport renderSupport;
        
        @AfterRender
        void renderCallback() {
                // generate a link which when used client side will
invoke event handler below
                Link link = resources.createEventLink("provideContent");
                // get tapestry to initialise us client side
                renderSupport.addInit("lazyZoneLoad", getClientId(),
link.toURI());
        }
        
        public Object onProvideContent() {
                // return the block which was passed as parameter,
tapestry
                // will render it for us
                return content;
        }
}

lazyZone.js
-----------
Tapestry.Initializer.lazyZoneLoad = function(element, url) {
        $T(element).zoneManager.updateFromURL(url);
}


HTH
Alfie.
-----Original Message-----
From: Michael Dukaczewski [mailto:m.dukaczew...@tu-bs.de] Sent: 05 May 2009 20:54
To: Tapestry users
Subject: automatic zone update

I'm trying to create a zone which automatically updates itself after
some time. Any suggestions?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to