org.apache.tapestry5
Interface RenderSupport

All Known Implementing Classes:
RenderSupportImpl

Deprecated. RenderSupport has been replaced by JavaScriptSupport and may be removed after Tapestry 5.3.

public interface RenderSupport

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.

The methods in this interface are largely being replaced with a new environmental interface, JavaScriptSupport.

RenderSupport is normally accessed within a component by using the Environmental annotation on a component field. In addition, RenderSupport may also be accessed as a service (the service internally delegates to the current environmental instance), which is useful for service-layer objects.


Method Summary
 void addClasspathScriptLink(String... classpaths)
          Deprecated. Use JavaScriptSupport.importJavaScriptLibrary(Asset) instead
 void addInit(String functionName, JSONArray parameterList)
          Deprecated. Use JavaScriptSupport.addInitializerCall(String, JSONObject) instead (which may require changes to your JavaScript initializer function)
 void addInit(String functionName, JSONObject parameter)
          Deprecated. Use JavaScriptSupport.addInitializerCall(String, JSONObject) instead
 void addInit(String functionName, String... parameters)
          Deprecated. Use JavaScriptSupport.addInitializerCall(String, JSONObject) instead (which may require changes to your JavaScript initializer function), or (for a single parameter) JavaScriptSupport.addInitializerCall(String, String)
 void addScript(String script)
          Deprecated. Use JavaScriptSupport.addScript(String, Object...) instead
 void addScript(String format, Object... arguments)
          Deprecated. Use JavaScriptSupport.addScript(String, Object...) instead
 void addScriptLink(Asset... scriptAssets)
          Deprecated. Use JavaScriptSupport.importJavaScriptLibrary(Asset) instead
 void addScriptLink(String... scriptURLs)
          Deprecated. Use JavaScriptSupport.importJavaScriptLibrary(String) instead
 void addStylesheetLink(Asset stylesheet, String media)
          Deprecated. Adds a link to a CSS stylesheet.
 void addStylesheetLink(String stylesheetURL, String media)
          Deprecated. Adds a stylesheet as a URL.
 String allocateClientId(ComponentResources resources)
          Deprecated. Use JavaScriptSupport.allocateClientId(ComponentResources) instead
 String allocateClientId(String id)
          Deprecated. Use JavaScriptSupport.allocateClientId(String) instead
 void autofocus(FieldFocusPriority priority, String fieldId)
          Deprecated. Invoked to set focus on a rendered field.
 

Method Detail

allocateClientId

String allocateClientId(String id)
Deprecated. Use JavaScriptSupport.allocateClientId(String) instead

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, JavaScriptSupport.allocateClientId(ComponentResources)

allocateClientId

String allocateClientId(ComponentResources resources)
Deprecated. Use JavaScriptSupport.allocateClientId(ComponentResources) instead

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)
Deprecated. Use JavaScriptSupport.importJavaScriptLibrary(Asset) instead

Adds one or more new script assets to the page. Assets are added uniquely, and appear as <script> elements inside the <head> element of the rendered page. Duplicate requests to add the same script are quietly ignored.

Parameters:
scriptAssets - asset to the script to add

addScriptLink

void addScriptLink(String... scriptURLs)
Deprecated. Use JavaScriptSupport.importJavaScriptLibrary(String) instead

Adds some number of script links as strings representations of URLs. The scripts are passed down to the client as-is. Typically, this is used to reference a script stored outside the web application entirely.

Parameters:
scriptURLs - URL strings of scripts
Throws:
RuntimeException - always as of 5.2.0

addClasspathScriptLink

void addClasspathScriptLink(String... classpaths)
Deprecated. Use JavaScriptSupport.importJavaScriptLibrary(Asset) instead

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)
Deprecated. 
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

addStylesheetLink

void addStylesheetLink(String stylesheetURL,
                       String media)
Deprecated. 
Adds a stylesheet as a URL. See notes in addScriptLink(String[]).

Parameters:
stylesheetURL - URL string of stylesheet
media - media value for the stylesheet, or null to not specify a specific media type

addScript

void addScript(String script)
Deprecated. Use JavaScriptSupport.addScript(String, Object...) instead

Adds a script statement to the page's script block. A newline will be added after the script statement.

Parameters:
script - text to be added to the script block

addScript

void addScript(String format,
               Object... arguments)
Deprecated. Use JavaScriptSupport.addScript(String, Object...) instead

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.

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

addInit

void addInit(String functionName,
             JSONArray parameterList)
Deprecated. Use JavaScriptSupport.addInitializerCall(String, JSONObject) instead (which may require changes to your JavaScript initializer function)

Add an initialization call. This method is deprecated and, although it still works, it now generates very verbose, inefficient client-side JavaScript.

Parameters:
functionName - the name of the function (on the client-side Tapestry.Initializer object) to invoke.
parameterList - list of parameters for the method invocation.
See Also:
addScript(String, Object[])

addInit

void addInit(String functionName,
             JSONObject parameter)
Deprecated. Use JavaScriptSupport.addInitializerCall(String, JSONObject) instead

Alternate version of addInit(String, org.apache.tapestry5.json.JSONArray) where just a single object is passed.

Parameters:
functionName - the name of the function (on the client-side Tapestry object) to invoke.
parameter - the object to pass to the function

addInit

void addInit(String functionName,
             String... parameters)
Deprecated. Use JavaScriptSupport.addInitializerCall(String, JSONObject) instead (which may require changes to your JavaScript initializer function), or (for a single parameter) JavaScriptSupport.addInitializerCall(String, String)

Alternate version of addInit(String, org.apache.tapestry5.json.JSONArray) where one or more strings are passed. A single string is added to the initialization call as itself; otherwise, the parameters are combined to form a JSONArray. This method is deprecated and, although it still works, it now generates very verbose, inefficient client-side JavaScript.

Parameters:
functionName - the name of the function (on the client-side Tapestry object) to invoke.
parameters -

autofocus

void autofocus(FieldFocusPriority priority,
               String fieldId)
Deprecated. 
Invoked to set focus on a rendered field. Takes into account priority, meaning that a field with errors will take precedence over a merely required field, and over a field that is optional. The value FieldFocusPriority.OVERRIDE can be used to force a particular field to receive focus.

Parameters:
priority - focus is set only if the provided priority is greater than the current priority
fieldId - id of client-side element to take focus


Copyright © 2003-2012 The Apache Software Foundation.