CVS: TapestryBook/petstore/src/org/apache/tapestry/pets/components ProductLink.java,NONE,1.1 Banner.java,NONE,1.1 DirectArea.java,NONE,1.1
Howard Lewis Ship <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tapestry/TapestryBook/petstore/src/org/apache/tapestry/pets/components
In directory sc8-pr-cvs1:/tmp/cvs-serv19059/petstore/src/org/apache/tapestry/pets/components
Added Files:
ProductLink.java Banner.java DirectArea.java
Log Message:
Add start of petstore application.
--- NEW FILE: ProductLink.java ---
package org.apache.tapestry.pets.components;
import org.apache.tapestry.pets.domain.Product;
import net.sf.tapestry.BaseComponent;
public class ProductLink extends BaseComponent
{
private Product _product;
public Product getProduct()
{
return _product;
}
public void setProduct(Product product)
{
_product = product;
}
}
--- NEW FILE: Banner.java ---
package org.apache.tapestry.pets.components;
import net.sf.tapestry.BaseComponent;
import net.sf.tapestry.IRequestCycle;
public abstract class Banner extends BaseComponent
{
public abstract String getSearchValue();
public void search(IRequestCycle cycle)
{
}
public void viewAccount(IRequestCycle cycle)
{
}
public void viewCart(IRequestCycle cycle)
{
}
public void signOut(IRequestCycle cycle)
{
}
public void signIn(IRequestCycle cycle)
{
}
}
--- NEW FILE: DirectArea.java ---
package org.apache.tapestry.pets.components;
import net.sf.tapestry.AbstractComponent;
import net.sf.tapestry.BindingException;
import net.sf.tapestry.IActionListener;
import net.sf.tapestry.IBinding;
import net.sf.tapestry.IDirect;
import net.sf.tapestry.IEngineService;
import net.sf.tapestry.IMarkupWriter;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.RequestCycleException;
import net.sf.tapestry.RequiredParameterException;
import net.sf.tapestry.Tapestry;
import net.sf.tapestry.engine.ILink;
import net.sf.tapestry.link.DirectLink;
/**
* Generates an <area> tag using the direct service, much like a
* {@link net.sf.tapestry.link.DirectLink}. Has a listener notified
* when the link is clicked, and service parameters.
*
* @author Howard Lewis Ship
* @version $Id: DirectArea.java,v 1.1 2003/02/07 16:44:58 hship Exp $
*
**/
public abstract class DirectArea extends AbstractComponent implements IDirect
{
private IBinding _listenerBinding;;
public abstract Object getParameters();
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
throws RequestCycleException
{
if (cycle.isRewinding())
return;
Object[] parameters = DirectLink.constructServiceParameters(getParameters());
IEngineService service = cycle.getEngine().getService(Tapestry.DIRECT_SERVICE);
ILink link = service.getLink(cycle, this, parameters);
writer.beginEmpty("area");
writer.attribute("href", link.getURL());
generateAttributes(writer, cycle) ;
}
public void trigger(IRequestCycle cycle) throws RequestCycleException
{
IActionListener listener = null;
try
{
listener =
(IActionListener) _listenerBinding.getObject("listener", IActionListener.class);
}
catch (BindingException ex)
{
throw new RequestCycleException(this, ex);
}
if (listener == null)
throw new RequiredParameterException(this, "listener", _listenerBinding);
listener.actionTriggered(this, cycle);
}
public boolean isStateful()
{
return false;
}
public IBinding getListenerBinding()
{
return _listenerBinding;
}
public void setListenerBinding(IBinding listenerBinding)
{
_listenerBinding = listenerBinding;
}
}
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com