org.apache.tapestry.contrib.link
Class ButtonLinkRenderer

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

public class ButtonLinkRenderer
extends Object
implements 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 ILinkRenderer SHARED_INSTANCE
           
 
Constructor Summary
ButtonLinkRenderer()
           
 
Method Summary
protected  String getScript(String url)
          Generates the onclick event handler that opens the specified url in the current window.
protected  String getScript(String url, String target)
          Generates the onclick event handler that opens the specified url in the specified window or frame.
 void renderLink(IMarkupWriter writer, IRequestCycle cycle, ILinkComponent component)
          Renders the link, taking into account whether the link is disabled.
 
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 ILinkRenderer SHARED_INSTANCE
Constructor Detail

ButtonLinkRenderer

public ButtonLinkRenderer()
Method Detail

renderLink

public void renderLink(IMarkupWriter writer,
                       IRequestCycle cycle,
                       ILinkComponent component)
Description copied from interface: ILinkRenderer
Renders the link, taking into account whether the link is disabled. This is complicated by the fact that the rendering of the body must be done within a nested writer, since the Link component will not render its tag until after its body renders (to allow for any wrapped components that need to write event handlers for the link).

The renderer is expected to call back into the link component to handle any informal parameters, and to handle events output.

Specified by:
renderLink in interface ILinkRenderer
See Also:
ILinkRenderer.renderLink(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle, org.apache.tapestry.components.ILinkComponent)

getScript

protected String getScript(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 String getScript(String url,
                           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


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.