public class RenderSupportImpl extends Object implements RenderSupport
Constructor and Description |
---|
RenderSupportImpl(SymbolSource symbolSource,
AssetSource assetSource,
JavaScriptSupport javascriptSupport) |
Modifier and Type | Method and Description |
---|---|
void |
addClasspathScriptLink(String... classpaths)
Used to add scripts that are stored on the classpath.
|
void |
addInit(String functionName,
JSONArray parameterList)
Add an initialization call.
|
void |
addInit(String functionName,
JSONObject parameter)
Alternate version of
RenderSupport.addInit(String, org.apache.tapestry5.json.JSONArray) where just a single object is
passed. |
void |
addInit(String functionName,
String... parameters)
Alternate version of
RenderSupport.addInit(String, org.apache.tapestry5.json.JSONArray) where one or more strings are
passed. |
void |
addScript(String script)
Adds a script statement to the page's script block.
|
void |
addScript(String format,
Object... arguments)
Adds a script statement to the page's script block.
|
void |
addScriptLink(Asset... scriptAssets)
Adds one or more new script assets to the page.
|
void |
addScriptLink(String... scriptURLs)
Adds some number of script links as strings representations of URLs.
|
void |
addStylesheetLink(Asset stylesheet,
String media)
Adds a link to a CSS stylesheet.
|
void |
addStylesheetLink(String stylesheetURL,
String media)
Adds a stylesheet as a URL.
|
String |
allocateClientId(ComponentResources resources)
As with
RenderSupport.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.
|
void |
autofocus(FieldFocusPriority priority,
String fieldId)
Invoked to set focus on a rendered field.
|
public RenderSupportImpl(SymbolSource symbolSource, AssetSource assetSource, JavaScriptSupport javascriptSupport)
symbolSource
- Used to expand symbols (in addClasspathScriptLink(String...)assetSource
- Used to convert classpath scripts to Asset
sjavascriptSupport
- Used to add JavaScript libraries and blocks of initialization JavaScript to the rendered pagepublic String allocateClientId(String id)
RenderSupport
allocateClientId
in interface RenderSupport
id
- the component id from which a unique id will be generatedIdAllocator
,
JavaScriptSupport.allocateClientId(ComponentResources)
public String allocateClientId(ComponentResources resources)
RenderSupport
RenderSupport.allocateClientId(String)
but uses the id of the component extracted from the resources.allocateClientId
in interface RenderSupport
resources
- of the component which requires an idpublic void addScriptLink(Asset... scriptAssets)
RenderSupport
addScriptLink
in interface RenderSupport
scriptAssets
- asset to the script to addpublic void addScriptLink(String... scriptURLs)
RenderSupport
addScriptLink
in interface RenderSupport
scriptURLs
- URL strings of scriptspublic void addClasspathScriptLink(String... classpaths)
RenderSupport
addClasspathScriptLink
in interface RenderSupport
classpaths
- array of paths. Symbols in the paths are expanded, then the paths are each converted into an
asset.public void addScript(String script)
RenderSupport
addScript
in interface RenderSupport
script
- text to be added to the script blockpublic void addScript(String format, Object... arguments)
RenderSupport
String.format(String, Object[])
before being added to the script block. A newline will be added after the
formatted statement.addScript
in interface RenderSupport
format
- base string format, to be passed through String.formatarguments
- additional arguments formatted to form the final scriptpublic void addInit(String functionName, JSONArray parameterList)
RenderSupport
addInit
in interface RenderSupport
functionName
- the name of the function (on the client-side Tapestry.Initializer object) to invoke.parameterList
- list of parameters for the method invocation.RenderSupport.addScript(String, Object[])
public void addInit(String functionName, JSONObject parameter)
RenderSupport
RenderSupport.addInit(String, org.apache.tapestry5.json.JSONArray)
where just a single object is
passed.addInit
in interface RenderSupport
functionName
- the name of the function (on the client-side Tapestry object) to invoke.parameter
- the object to pass to the functionpublic void addInit(String functionName, String... parameters)
RenderSupport
RenderSupport.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.addInit
in interface RenderSupport
functionName
- the name of the function (on the client-side Tapestry object) to invoke.public void autofocus(FieldFocusPriority priority, String fieldId)
RenderSupport
FieldFocusPriority.OVERRIDE
can be used to force a particular field to receive
focus.autofocus
in interface RenderSupport
priority
- focus is set only if the provided priority is greater than the current priorityfieldId
- id of client-side element to take focuspublic void addStylesheetLink(Asset stylesheet, String media)
RenderSupport
addStylesheetLink
in interface RenderSupport
stylesheet
- the asset referencing the stylesheetmedia
- the media value for the stylesheet, or null to not specify a specific media typepublic void addStylesheetLink(String stylesheetURL, String media)
RenderSupport
RenderSupport.addScriptLink(String[])
.addStylesheetLink
in interface RenderSupport
stylesheetURL
- URL string of stylesheetmedia
- media value for the stylesheet, or null to not specify a specific media typeCopyright © 2003-2012 The Apache Software Foundation.