ZoneRefreshDemoOne : Source Code

  <html xmlns:t="" >
               <title>Zone Refresh demo </title>

    <h1>ZoneRefresh Demo One</h1>

A demo on the mixin
   <a href="${message:componentHomePage}">
     The source code of this demo
            is <a href="#" t:type="PageLink"
                  t:page="test/core/mixin/ZoneRefreshDemoOneSource" target="_blank">here</a>.
 The linear, quadratic and cubic equations will be displayed in 5 second interval. 
     <t:zone  style="float:left; width: 850px;" t:mixins='zoneRefresh' t:period='5'  t:id='imageZone'>
        <t:block id="imageBlock">
             ${equation} <br/>
            <img src="${equationImage}" />




import org.apache.tapestry5.Asset;
import org.apache.tapestry5.Block;
import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.annotations.Path;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

public class ZoneRefreshDemoOne {

	private Asset linear;

	private Asset quadratic;

	private Asset cubic;

	private Block imageBlock;

	private Asset[] images;

	private static final String[] EQUATIONS = { "Linear", "Quadratic", "Cubic" };

	private int index;

	public void pageLoaded() {
		images = new Asset[] { linear, quadratic, cubic };

	public String getEquation() {
		return EQUATIONS[index];

	public String[] getEquations() {
		return EQUATIONS;

	public Asset getEquationImage() {
		return images[index];

	 * This is called every 3 seconds. 
	Object onRefreshFromImageZone() {
		index = index + 1;
		if (index >= 3) {
			index = index - 3;
		return imageBlock;