org.apache.tapestry.internal.services
Class PageRenderSupportImpl

java.lang.Object
  extended by org.apache.tapestry.internal.services.PageRenderSupportImpl
All Implemented Interfaces:
PageRenderSupport

public class PageRenderSupportImpl
extends Object
implements PageRenderSupport


Constructor Summary
PageRenderSupportImpl(DocumentHeadBuilder builder, SymbolSource symbolSource, AssetSource assetSource, String... coreScripts)
           
 
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 PageRenderSupport.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageRenderSupportImpl

public PageRenderSupportImpl(DocumentHeadBuilder builder,
                             SymbolSource symbolSource,
                             AssetSource assetSource,
                             String... coreScripts)
Parameters:
builder - Used to assemble JavaScript includes and snippets
symbolSource - Used to example symbols (in {@linkplain #addClasspathScriptLink(String...) in classpath scripts)
assetSource - Used to convert classpath scripts to Assets
coreScripts - core scripts (evaluated as classpaths scripts) that are added to any page that includes a script link or script block
Method Detail

allocateClientId

public String allocateClientId(String id)
Description copied from interface: PageRenderSupport
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).

Specified by:
allocateClientId in interface PageRenderSupport
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

public String allocateClientId(ComponentResources resources)
Description copied from interface: PageRenderSupport
As with PageRenderSupport.allocateClientId(String) but uses the id of the component extracted from the resources.

Specified by:
allocateClientId in interface PageRenderSupport
Parameters:
resources - of the component which requires an id
Returns:
a unique id for this rendering of the page

addScriptLink

public void addScriptLink(Asset... scriptAssets)
Description copied from interface: PageRenderSupport
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.

Specified by:
addScriptLink in interface PageRenderSupport
Parameters:
scriptAssets - asset to the script to add

addClasspathScriptLink

public void addClasspathScriptLink(String... classpaths)
Description copied from interface: PageRenderSupport
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.

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

addScript

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

Specified by:
addScript in interface PageRenderSupport
Parameters:
format - base string format, to be passed through String.format
arguments - additional arguments formatted to form the final script

addStylesheetLink

public void addStylesheetLink(Asset stylesheet,
                              String media)
Description copied from interface: PageRenderSupport
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.

Specified by:
addStylesheetLink in interface PageRenderSupport
Parameters:
stylesheet - the asset referencing the stylesheet
media - the media value for the stylesheet, or null to not specify a specific media type


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