Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5.internal.services.ajax
Class JavaScriptSupportImpl

    java.lang.Object
      org.apache.tapestry5.internal.services.ajax.JavaScriptSupportImpl

All Implemented Interfaces:
  JavaScriptSupport

    public class JavaScriptSupportImpl

extends java.lang.Object
implements JavaScriptSupport

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, java.lang.String functionName, JSONArray parameter)` Adds a call to a client-side function inside the Tapestry.Initializer namespace.
`void` | `addInitializerCall(InitializationPriority priority, java.lang.String functionName, JSONObject parameter)` Adds a call to a client-side function inside the Tapestry.Initializer namespace.
`void` | `addInitializerCall(InitializationPriority priority, java.lang.String functionName, java.lang.String parameter)` Adds a call to a client-side function inside the Tapestry.Initializer namespace.
`void` | `addInitializerCall(java.lang.String functionName, JSONArray parameter)` Adds a call to a client-side function inside the Tapestry.Initializer namespace.
`void` | `addInitializerCall(java.lang.String functionName, JSONObject parameter)` Adds a call to a client-side function inside the Tapestry.Initializer namespace.
`void` | `addInitializerCall(java.lang.String functionName, java.lang.String parameter)` Adds a call to a client-side function inside the Tapestry.Initializer namespace.
`void` | `addScript(InitializationPriority priority, java.lang.String format, java.lang.Object... arguments)` Adds initialization script at the specified priority.
`void` | `addScript(java.lang.String format, java.lang.Object... arguments)` Adds initialization script at `InitializationPriority.NORMAL` priority.
`java.lang.String` | `allocateClientId(ComponentResources resources)` As with `JavaScriptSupport.allocateClientId(String)` but uses the id of the component extracted from the resources.
`java.lang.String` | `allocateClientId(java.lang.String id)` Allocates a unique id based on the component's id.
`void` | `autofocus(FieldFocusPriority priority, java.lang.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(java.lang.String libraryURL)` Import a Javascript library with an arbitrary URL.
`void` | `importStack(java.lang.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

### JavaScriptSupportImpl

    public JavaScriptSupportImpl(DocumentLinker linker,
                                 JavaScriptStackSource javascriptStackSource,
                                 JavaScriptStackPathConstructor stackPathConstructor)

### JavaScriptSupportImpl

    public JavaScriptSupportImpl(DocumentLinker linker,
                                 JavaScriptStackSource javascriptStackSource,
                                 JavaScriptStackPathConstructor stackPathConstructor,
                                 IdAllocator idAllocator,
                                 boolean partialMode)

Parameters:
  `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

### commit

    public void commit()

### addInitializerCall

    public void addInitializerCall(InitializationPriority priority,
                                   java.lang.String functionName,
                                   JSONObject parameter)

  Description copied from interface: `JavaScriptSupport`
  Adds a call to a client-side function inside the Tapestry.Initializer namespace. Calls to this method are aggregated into a call to the Tapestry.init() function. Initialization occurs at the specified priority.

  Specified by:
    `addInitializerCall` in interface `JavaScriptSupport`
  Parameters:
    `priority` - priority to use when adding the script
    `functionName` - name of client-side function (within Tapestry.Initializer namespace) to execute
    `parameter` - object to pass to the client-side function

### addInitializerCall

    public void addInitializerCall(java.lang.String functionName,
                                   JSONArray parameter)

  Description copied from interface: `JavaScriptSupport`
  Adds a call to a client-side function inside the Tapestry.Initializer namespace. Calls to this method are aggregated into a call to the Tapestry.init() function. Initialization occurs at `InitializationPriority.NORMAL` priority.

  Specified by:
    `addInitializerCall` in interface `JavaScriptSupport`
  Parameters:
    `functionName` - name of client-side function (within Tapestry.Initializer namespace) to execute
    `parameter` - array of parameters to pass to the client-side function

### addInitializerCall

    public void addInitializerCall(InitializationPriority priority,
                                   java.lang.String functionName,
                                   JSONArray parameter)

  Description copied from interface: `JavaScriptSupport`
  Adds a call to a client-side function inside the Tapestry.Initializer namespace. Calls to this method are aggregated into a call to the Tapestry.init() function. Initialization occurs at `InitializationPriority.NORMAL` priority.

  Specified by:
    `addInitializerCall` in interface `JavaScriptSupport`
    `functionName` - name of client-side function (within Tapestry.Initializer namespace) to execute
    `parameter` - array of parameters to pass to the client-side function

### addInitializerCall

    public void addInitializerCall(java.lang.String functionName,
                                   JSONObject parameter)

  Description copied from interface: `JavaScriptSupport`
  Adds a call to a client-side function inside the Tapestry.Initializer namespace. Calls to this method are aggregated into a call to the Tapestry.init() function. Initialization occurs at `InitializationPriority.NORMAL` priority.

  Specified by:
    `addInitializerCall` in interface `JavaScriptSupport`
  Parameters:
    `functionName` - name of client-side function (within Tapestry.Initializer namespace) to execute
    `parameter` - object to pass to the client-side function

### addInitializerCall

    public void addInitializerCall(InitializationPriority priority,
                                   java.lang.String functionName,
                                   java.lang.String parameter)

  Description copied from interface: `JavaScriptSupport`
  Adds a call to a client-side function inside the Tapestry.Initializer namespace. Calls to this method are aggregated into a call to the Tapestry.init() function. Initialization occurs at the specified priority.

  Specified by:
    `addInitializerCall` in interface `JavaScriptSupport`
  Parameters:
    `priority` - priority to use when adding the script
    `functionName` - name of client-side function (within Tapestry.Initializer namespace) to execute
    `parameter` - string to pass to function (typically, a client id)

### addInitializerCall

    public void addInitializerCall(java.lang.String functionName,
                                   java.lang.String parameter)

  Description copied from interface: `JavaScriptSupport`
  Adds a call to a client-side function inside the Tapestry.Initializer namespace. Calls to this method are aggregated into a call to the Tapestry.init() function. Initialization occurs at `InitializationPriority.NORMAL` priority.

  Specified by:
    `addInitializerCall` in interface `JavaScriptSupport`
  Parameters:
    `functionName` - name of client-side function (within Tapestry.Initializer namespace) to execute
    `parameter` - string to pass to function (typically, a client id)

### addScript

    public void addScript(InitializationPriority priority,
                          java.lang.String format,
                          java.lang.Object... arguments)

  Description copied from interface: `JavaScriptSupport`
  Adds initialization script at the specified priority.

  Specified by:
    `addScript` in interface `JavaScriptSupport`
  Parameters:
    `priority` - priority to use when adding the script
    `format` - format string (as per `String.format(String, Object...)`
    `arguments` - arguments referenced by format specifiers

### addScript

    public void addScript(java.lang.String format,
                          java.lang.Object... arguments)

  Description copied from interface: `JavaScriptSupport`
  Adds initialization script at `InitializationPriority.NORMAL` priority.

  Specified by:
    `addScript` in interface `JavaScriptSupport`
  Parameters:
    `format` - format string (as per `String.format(String, Object...)`
    `arguments` - arguments referenced by format specifiers

### allocateClientId

    public java.lang.String allocateClientId(ComponentResources resources)

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

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

### allocateClientId

    public java.lang.String allocateClientId(java.lang.String id)

  Description copied from interface: `JavaScriptSupport`
  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 `JavaScriptSupport`
  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`

### importJavaScriptLibrary

    public void importJavaScriptLibrary(Asset asset)

  Description copied from interface: `JavaScriptSupport`
  Imports a JavaScript library as part of the rendered page. Libraries are added in the order they are first imported; duplicate imports are ignored.

  Specified by:
    `importJavaScriptLibrary` in interface `JavaScriptSupport`
  See Also:
    `Import`

### importJavaScriptLibrary

    public void importJavaScriptLibrary(java.lang.String libraryURL)

  Description copied from interface: `JavaScriptSupport`
  Import a Javascript library with an arbitrary URL.

  Specified by:
    `importJavaScriptLibrary` in interface `JavaScriptSupport`

### importStylesheet

    public void importStylesheet(Asset stylesheet)

  Description copied from interface: `JavaScriptSupport`
  A convenience method that wraps the Asset as a `StylesheetLink`.

  Specified by:
    `importStylesheet` in interface `JavaScriptSupport`
  Parameters:
    `stylesheet` - asset for the stylesheet
  See Also:
    `JavaScriptSupport.importStylesheet(StylesheetLink)`

### importStylesheet

    public void importStylesheet(StylesheetLink stylesheetLink)

  Description copied from interface: `JavaScriptSupport`
  Imports a Cascading Style Sheet file as part of the rendered page. Stylesheets are added in the order they are first imported; duplicate imports are ignored.

  Specified by:
    `importStylesheet` in interface `JavaScriptSupport`
  Parameters:
    `stylesheetLink` - encapsulates the link URL plus any additional options

### importStack

    public void importStack(java.lang.String stackName)

  Description copied from interface: `JavaScriptSupport`
  Imports a `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.

  Specified by:
    `importStack` in interface `JavaScriptSupport`
  Parameters:
    `stackName` - the name of the stack (case is ignored); the stack must exist

### autofocus

    public void autofocus(FieldFocusPriority priority,
                          java.lang.String fieldId)

  Description copied from interface: `JavaScriptSupport`
  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.

  Specified by:
    `autofocus` in interface `JavaScriptSupport`
  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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.