org.apache.tapestry
Interface PageRenderSupport

All Known Implementing Classes:
PageRenderSupportImpl, PartialRenderPageRenderSupport

public interface PageRenderSupport

Provides support to all components that render. This is primarily about generating unique client-side ids (very important for JavaScript generation) as well as accumulating JavaScript to be sent to the client. PageRenderSupport also allows for the incremental addition of stylesheets.


Method Summary
 void addClasspathScriptLink(String... classpaths)
          Used to add scripts that are stored on the classpath.
 void addScript(String format, Object... arguments)
          Adds a script statement to the page's script block (which appears at the end of the page, just before the </body> tag).
 void addScriptLink(Asset... scriptAssets)
          Adds one or more new script assets to the page.
 void addStylesheetLink(Asset stylesheet, String media)
          Adds a link to a CSS stylesheet.
 String allocateClientId(ComponentResources resources)
          As with allocateClientId(String) but uses the id of the component extracted from the resources.
 String allocateClientId(String id)
          Allocates a unique id based on the component's id.
 

Method Detail

allocateClientId

String allocateClientId(String id)
Allocates a unique id based on the component's id. In some cases, the return value will not precisely match the input value (an underscore and a unique index value may be appended).

Parameters:
id - the component id from which a unique id will be generated
Returns:
a unique id for this rendering of the page
See Also:
IdAllocator

allocateClientId

String allocateClientId(ComponentResources resources)
As with allocateClientId(String) but uses the id of the component extracted from the resources.

Parameters:
resources - of the component which requires an id
Returns:
a unique id for this rendering of the page

addScriptLink

void addScriptLink(Asset... scriptAssets)
Adds one or more new script assets to the page. Assets are added uniquely, and appear as <script> elements just inside the <body> element of the rendered page. Duplicate requests to add the same script are quietly ignored.

Parameters:
scriptAssets - asset to the script to add

addClasspathScriptLink

void addClasspathScriptLink(String... classpaths)
Used to add scripts that are stored on the classpath. Each element has symbols expanded, then is converted to an asset and added as a script link.

Parameters:
classpaths - array of paths. Symbols in the paths are expanded, then the paths are each converted into an asset.

addStylesheetLink

void addStylesheetLink(Asset stylesheet,
                       String media)
Adds a link to a CSS stylesheet. As with JavaScript libraries, each stylesheet is added at most once. Stylesheets added this way will be ordered before any other content in the <head> element of the document. The <head> element will be created, if necessary.

Parameters:
stylesheet - the asset referencing the stylesheet
media - the media value for the stylesheet, or null to not specify a specific media type

addScript

void addScript(String format,
               Object... arguments)
Adds a script statement to the page's script block (which appears at the end of the page, just before the </body> tag).

Parameters:
format - base string format, to be passed through String.format
arguments - additional arguments formatted to form the final script


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