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.
When rendering, a <script> block will be added to the bottom of the page (just before the </body> tag).
The scripting statements added to this block will be executed, on the client, only once the page has fully loaded.
| Method from org.apache.tapestry5.RenderSupport Detail: |
public void addClasspathScriptLink(String classpaths)
Used to add scripts that are stored on the classpath. Each element has {@linkplain SymbolSource symbols
expanded}, then is {@linkplain AssetSource converted to an asset} and added as a script link. |
public void addInit(String functionName,
JSONArray parameterList)
Add an initialization call. |
public void addInit(String functionName,
JSONObject parameter)
|
public void addInit(String functionName,
String parameters)
|
public void addScript(String script)
Adds a script statement to the page's script block. A newline will be added after the script statement. |
public void addScript(String format,
Object arguments)
Adds a script statement to the page's script block. The parameters are passed to String#format(String,
Object[]) before being added to the script block. A newline will be added after the formatted statement. |
public 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. |
public void addScriptLink(String scriptURLs)
Adds some number of script links as strings representations of URLs. The scripts are passed down to the client
as-is. Note that Tapestry generates relative URLs for assets because the base URL varies dependending on the page
and its activation context; scripts added with this method will not be adjusted in anyway. Typically, this is
used to reference a script stored outside the web application entirely. |
public 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. |
public void addStylesheetLink(String stylesheetURL,
String media)
|
public 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). |
public String allocateClientId(ComponentResources resources)
|
public void autofocus(FieldFocusPriority priority,
String fieldId)
Invoked to set focus on a rendered field. Takes into account priority, meaning that a field with errors will take
precendence over a merely required field, and over a field that is optional. |