CVS: TapestryBook/examples/src/java/examples/pets PetCategory.java,NONE,1.1 Pets.java,NONE,1.1

Howard Lewis Ship <[email protected]> Fri, 11 Jul 2003 21:16:48 -0700
Newsgroups gmane.comp.java.tapestry.cvs
Message-ID <[email protected]>
Update of /cvsroot/tapestry/TapestryBook/examples/src/java/examples/pets
In directory sc8-pr-cvs1:/tmp/cvs-serv6871/examples/src/java/examples/pets

Added Files:
	PetCategory.java Pets.java 
Log Message:
Reorganize examples application to reflect standard organization

--- NEW FILE: PetCategory.java ---
package examples.pets;

import org.apache.tapestry.IAsset;
import org.apache.tapestry.html.BasePage;

public abstract class PetCategory extends BasePage
{
	public abstract void setType(String type);
	public abstract String getType();
	
	public String getPageTitle()
	{
		return getMessages().getMessage("title." + getType());
	}
	
	public IAsset getImage()
	{
		return getAsset(getType());
	}
	
	public String getTypeName()
	{
		return getMessages().getMessage(getType());
	}
}

--- NEW FILE: Pets.java ---
package examples.pets;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;

public class Pets extends BasePage
{
    private void select(String type)
    {
        IRequestCycle cycle = getRequestCycle();

        PetCategory next = (PetCategory) cycle.getPage("PetCategory");

        next.setType(type);
        cycle.activate(next);
    }

    public void selectBirds(IRequestCycle cycle)
    {
        select("birds");
    }

    public void selectCats(IRequestCycle cycle)
    {
        select("cats");
    }

    public void selectDogs(IRequestCycle cycle)
    {
        select("dogs");
    }

    public void selectFish(IRequestCycle cycle)
    {
        select("fish");
    }

    public void selectReptiles(IRequestCycle cycle)
    {
        select("reptiles");
    }
}



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1