|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry5.internal.services.ajax.JavaScriptSupportImpl
public class JavaScriptSupportImpl
Constructor Summary | |
---|---|
JavaScriptSupportImpl(DocumentLinker linker,
JavaScriptStackSource javascriptStackSource,
JavaScriptStackPathConstructor stackPathConstructor)
|
|
JavaScriptSupportImpl(DocumentLinker linker,
JavaScriptStackSource javascriptStackSource,
JavaScriptStackPathConstructor stackPathConstructor,
IdAllocator idAllocator,
boolean partialMode)
|
Method Summary | |
---|---|
void |
addInitializerCall(InitializationPriority priority,
String functionName,
JSONArray parameter)
Adds a call to a client-side function inside the Tapestry.Initializer namespace. |
void |
addInitializerCall(InitializationPriority priority,
String functionName,
JSONObject parameter)
Adds a call to a client-side function inside the Tapestry.Initializer namespace. |
void |
addInitializerCall(InitializationPriority priority,
String functionName,
String parameter)
Adds a call to a client-side function inside the Tapestry.Initializer namespace. |
void |
addInitializerCall(String functionName,
JSONArray parameter)
Adds a call to a client-side function inside the Tapestry.Initializer namespace. |
void |
addInitializerCall(String functionName,
JSONObject parameter)
Adds a call to a client-side function inside the Tapestry.Initializer namespace. |
void |
addInitializerCall(String functionName,
String parameter)
Adds a call to a client-side function inside the Tapestry.Initializer namespace. |
void |
addScript(InitializationPriority priority,
String format,
Object... arguments)
Adds initialization script at the specified priority. |
void |
addScript(String format,
Object... arguments)
Adds initialization script at InitializationPriority.NORMAL priority. |
String |
allocateClientId(ComponentResources resources)
As with JavaScriptSupport.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. |
void |
commit()
|
void |
importJavaScriptLibrary(Asset asset)
Imports a JavaScript library as part of the rendered page. |
void |
importJavaScriptLibrary(String libraryURL)
Import a Javascript library with an arbitrary URL. |
void |
importStack(String stackName)
Imports a JavaScriptStack by name, a related set of JavaScript libraries and stylesheets. |
void |
importStylesheet(Asset stylesheet)
A convenience method that wraps the Asset as a StylesheetLink . |
void |
importStylesheet(StylesheetLink stylesheetLink)
Imports a Cascading Style Sheet file as part of the rendered page. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JavaScriptSupportImpl(DocumentLinker linker, JavaScriptStackSource javascriptStackSource, JavaScriptStackPathConstructor stackPathConstructor)
public JavaScriptSupportImpl(DocumentLinker linker, JavaScriptStackSource javascriptStackSource, JavaScriptStackPathConstructor stackPathConstructor, IdAllocator idAllocator, boolean partialMode)
linker
- responsible for assembling all the information gathered by JavaScriptSupport and
attaching it to the Document (for a full page render) or to the JSON response (in a partial render)javascriptStackSource
- source of information about JavaScriptStack
s, used when handling the import
of libraries and stacks (often, to handle transitive dependencies)stackPathConstructor
- encapsulates the knowledge of how to represent a stack (which may be converted
from a series of JavaScript libraries into a single virtual JavaScript library)idAllocator
- used when allocating unique ids (it is usually pre-initialized in an Ajax request to ensure
that newly allocated ids do not conflict with previous renders and partial updates)partialMode
- if true, then the JSS configures itself for a partial page render (part of an Ajax request)
which automatically assumes the "core" library has been added (to the original page render)
and makes other minor changes to behavior.Method Detail |
---|
public void commit()
public void addInitializerCall(InitializationPriority priority, String functionName, JSONObject parameter)
JavaScriptSupport
addInitializerCall
in interface JavaScriptSupport
priority
- priority to use when adding the scriptfunctionName
- name of client-side function (within Tapestry.Initializer namespace) to executeparameter
- object to pass to the client-side functionpublic void addInitializerCall(String functionName, JSONArray parameter)
JavaScriptSupport
InitializationPriority.NORMAL
priority.
addInitializerCall
in interface JavaScriptSupport
functionName
- name of client-side function (within Tapestry.Initializer namespace) to executeparameter
- array of parameters to pass to the client-side functionpublic void addInitializerCall(InitializationPriority priority, String functionName, JSONArray parameter)
JavaScriptSupport
InitializationPriority.NORMAL
priority.
addInitializerCall
in interface JavaScriptSupport
functionName
- name of client-side function (within Tapestry.Initializer namespace) to executeparameter
- array of parameters to pass to the client-side functionpublic void addInitializerCall(String functionName, JSONObject parameter)
JavaScriptSupport
InitializationPriority.NORMAL
priority.
addInitializerCall
in interface JavaScriptSupport
functionName
- name of client-side function (within Tapestry.Initializer namespace) to executeparameter
- object to pass to the client-side functionpublic void addInitializerCall(InitializationPriority priority, String functionName, String parameter)
JavaScriptSupport
addInitializerCall
in interface JavaScriptSupport
priority
- priority to use when adding the scriptfunctionName
- name of client-side function (within Tapestry.Initializer namespace) to executeparameter
- string to pass to function (typically, a client id)public void addInitializerCall(String functionName, String parameter)
JavaScriptSupport
InitializationPriority.NORMAL
priority.
addInitializerCall
in interface JavaScriptSupport
functionName
- name of client-side function (within Tapestry.Initializer namespace) to executeparameter
- string to pass to function (typically, a client id)public void addScript(InitializationPriority priority, String format, Object... arguments)
JavaScriptSupport
addScript
in interface JavaScriptSupport
priority
- priority to use when adding the scriptformat
- format string (as per String.format(String, Object...)
arguments
- arguments referenced by format specifierspublic void addScript(String format, Object... arguments)
JavaScriptSupport
InitializationPriority.NORMAL
priority.
addScript
in interface JavaScriptSupport
format
- format string (as per String.format(String, Object...)
arguments
- arguments referenced by format specifierspublic String allocateClientId(ComponentResources resources)
JavaScriptSupport
JavaScriptSupport.allocateClientId(String)
but uses the id of the component extracted from the resources.
allocateClientId
in interface JavaScriptSupport
resources
- of the component which requires an id
public String allocateClientId(String id)
JavaScriptSupport
allocateClientId
in interface JavaScriptSupport
id
- the component id from which a unique id will be generated
IdAllocator
public void importJavaScriptLibrary(Asset asset)
JavaScriptSupport
importJavaScriptLibrary
in interface JavaScriptSupport
Import
public void importJavaScriptLibrary(String libraryURL)
JavaScriptSupport
importJavaScriptLibrary
in interface JavaScriptSupport
public void importStylesheet(Asset stylesheet)
JavaScriptSupport
StylesheetLink
.
importStylesheet
in interface JavaScriptSupport
stylesheet
- asset for the stylesheetJavaScriptSupport.importStylesheet(StylesheetLink)
public void importStylesheet(StylesheetLink stylesheetLink)
JavaScriptSupport
importStylesheet
in interface JavaScriptSupport
stylesheetLink
- encapsulates the link URL plus any additional optionspublic void importStack(String stackName)
JavaScriptSupport
JavaScriptStack
by name, a related set of JavaScript libraries and stylesheets.
Stacks are contributions to the JavaScriptStackSource
service. When
JavaScript aggregation in enabled, the stack will be represented by
a single virtual URL; otherwise the individual asset URLs of the stack
will be added to the document.
importStack
in interface JavaScriptSupport
stackName
- the name of the stack (case is ignored); the stack must existpublic void autofocus(FieldFocusPriority priority, String fieldId)
JavaScriptSupport
FieldFocusPriority.OVERRIDE
can be used to force a particular field to receive
focus.
autofocus
in interface JavaScriptSupport
priority
- focus is set only if the provided priority is greater than the current priorityfieldId
- id of client-side element to take focus
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |