org.apache.tapestry.contrib.link
Class ButtonLinkRenderer

java.lang.Object
  extended byorg.apache.tapestry.contrib.link.ButtonLinkRenderer
All Implemented Interfaces:
org.apache.tapestry.link.ILinkRenderer

public class ButtonLinkRenderer
extends java.lang.Object
implements org.apache.tapestry.link.ILinkRenderer

An ILinkRenderer implementation that generates an HTML button. This is particularly useful for implementing cancel buttons.

Since:
4.0
Author:
Paul Ferraro

Field Summary
static org.apache.tapestry.link.ILinkRenderer SHARED_INSTANCE
           
 
Constructor Summary
ButtonLinkRenderer()
           
 
Method Summary
protected  java.lang.String getScript(java.lang.String url)
          Generates the onclick event handler that opens the specified url in the current window.
protected  java.lang.String getScript(java.lang.String url, java.lang.String target)
          Generates the onclick event handler that opens the specified url in the specified window or frame.
 void renderLink(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.components.ILinkComponent component)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHARED_INSTANCE

public static final org.apache.tapestry.link.ILinkRenderer SHARED_INSTANCE
Constructor Detail

ButtonLinkRenderer

public ButtonLinkRenderer()
Method Detail

renderLink

public void renderLink(org.apache.tapestry.IMarkupWriter writer,
                       org.apache.tapestry.IRequestCycle cycle,
                       org.apache.tapestry.components.ILinkComponent component)
Specified by:
renderLink in interface org.apache.tapestry.link.ILinkRenderer
See Also:
ILinkRenderer.renderLink(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle, org.apache.tapestry.components.ILinkComponent)

getScript

protected java.lang.String getScript(java.lang.String url)
Generates the onclick event handler that opens the specified url in the current window.

Parameters:
url - the url generated by this link
Returns:
a JavaScript onclick event handler

getScript

protected java.lang.String getScript(java.lang.String url,
                                     java.lang.String target)
Generates the onclick event handler that opens the specified url in the specified window or frame.

Parameters:
url - the url generated by this link
target - the name of the target window or frame
Returns:
a JavaScript onclick event handler