org.apache.tapestry
Interface IScriptProcessor

All Known Subinterfaces:
PageRenderSupport, ResponseBuilder, ScriptSession
All Known Implementing Classes:
DefaultResponseBuilder, DojoAjaxResponseBuilder, JSONResponseBuilder, PageRenderSupportImpl, PrototypeResponseBuilder, ScriptSessionImpl

public interface IScriptProcessor

Defines methods needed by a IScriptto execute.

Since:
3.0
Author:
Howard Lewis Ship
See Also:
Body

Method Summary
 void addBodyScript(IComponent target, String script)
          Adds scripting code to the main body.
 void addBodyScript(String script)
          Deprecated. To be removed sometime after 4.1.
 void addExternalScript(IComponent target, org.apache.hivemind.Resource resource)
          Adds an external script.
 void addExternalScript(org.apache.hivemind.Resource resource)
          Deprecated. To be removed sometime after 4.1
 void addInitializationScript(IComponent target, String script)
          Adds initialization script.
 void addInitializationScript(String script)
          Deprecated. To be removed sometime after 4.1.
 void addScriptAfterInitialization(IComponent target, String script)
          Works in the same way as addInitializationScript(IComponent, String) - except this method causes the script being added to appear after all of the script content written out from the normal initialization script processing happens.
 String getUniqueString(String baseValue)
          Ensures that the given string is unique.
 boolean isBodyScriptAllowed(IComponent target)
          Determines if the specified component should have its javascript body added to the response.
 boolean isExternalScriptAllowed(IComponent target)
          Determines if the specified component should have its javascript external resource scripts added to the response.
 boolean isInitializationScriptAllowed(IComponent target)
          Determines if the specified component should have its javascript initialization added to the response.
 

Method Detail

addBodyScript

void addBodyScript(String script)
Deprecated. To be removed sometime after 4.1.

Adds scripting code to the main body. During the render, multiple scripts may render multiple bodies; all are concatinated together to form a single block. The Body component will write the body script contents just inside the <body> tag.

See Also:
#addBodyScript(IComponent, String)}

addBodyScript

void addBodyScript(IComponent target,
                   String script)
Adds scripting code to the main body. During the render, multiple scripts may render multiple bodies; all are concatinated together to form a single block. The Body component will write the body script contents just inside the <body> tag.

Parameters:
target - The component this script is being added for.
script - The script to add to the body response.

addInitializationScript

void addInitializationScript(String script)
Deprecated. To be removed sometime after 4.1.

Adds initialization script. Initialization script is executed once, when the containing page loads. Initialization script content is written only after all HTML content that could be referenced from the script (in effect, just before the </body> tag).

See Also:
#addInitializationScript(IComponent, String)}

addInitializationScript

void addInitializationScript(IComponent target,
                             String script)
Adds initialization script. Initialization script is executed once, when the containing page loads. Initialization script content is written only after all HTML content that could be referenced from the script (in effect, just before the </body> tag).

Parameters:
target - The component the script is being added for.
script - The script to add.

addScriptAfterInitialization

void addScriptAfterInitialization(IComponent target,
                                  String script)
Works in the same way as addInitializationScript(IComponent, String) - except this method causes the script being added to appear after all of the script content written out from the normal initialization script processing happens. This is useful if you have some initialization script logic that absolutely must happen at the very end of the rest of things.

Parameters:
target - The component the script is being added for.
script - The script to add.
See Also:
#addInitializationScript(IComponent, String)}.

addExternalScript

void addExternalScript(org.apache.hivemind.Resource resource)
Deprecated. To be removed sometime after 4.1

Adds an external script. The processor is expected to ensure that external scripts are only loaded a single time per page.

See Also:
#addExternalScript(IComponent, Resource)}

addExternalScript

void addExternalScript(IComponent target,
                       org.apache.hivemind.Resource resource)
Adds an external script. The processor is expected to ensure that external scripts are only loaded a single time per page. The target will be checked to filter the scripts added for those types of responses that require them.

Parameters:
target - The component the script is being added for.
resource - The external script to add.

isBodyScriptAllowed

boolean isBodyScriptAllowed(IComponent target)
Determines if the specified component should have its javascript body added to the response.

Parameters:
target - The component to allow/disallow body script content from.
Returns:
True if the component script should be allowed.

isInitializationScriptAllowed

boolean isInitializationScriptAllowed(IComponent target)
Determines if the specified component should have its javascript initialization added to the response.

Parameters:
target - The component to allow/disallow initialization script content from.
Returns:
True if the component script should be allowed.

isExternalScriptAllowed

boolean isExternalScriptAllowed(IComponent target)
Determines if the specified component should have its javascript external resource scripts added to the response.

Parameters:
target - The component to check for inclusion/exclusion.
Returns:
True if external scripts from this component should be added to the response.

getUniqueString

String getUniqueString(String baseValue)
Ensures that the given string is unique. The string is either returned unchanged, or a suffix is appended to ensure uniqueness.



Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.