org.apache.tapestry5.internal.services
Interface DocumentLinker

All Known Implementing Classes:
DocumentLinkerImpl, PartialMarkupDocumentLinker

public interface DocumentLinker

Responsible for injecting script and style links into the <head> and <body> element of the rendered HTML document.


Method Summary
 void addScript(InitializationPriority priority, String script)
          Adds JavaScript code.
 void addScriptLink(String scriptURL)
          Adds a link to load a JavaScript library.
 void addStylesheetLink(StylesheetLink stylesheet)
          Adds a link to load a CSS stylesheet.
 void setInitialization(InitializationPriority priority, JSONObject initialization)
          Adds a call to the Tapestry.init() function.
 

Method Detail

addScriptLink

void addScriptLink(String scriptURL)
Adds a link to load a JavaScript library. . The <script> elements will be added inside the document's <head>.


addStylesheetLink

void addStylesheetLink(StylesheetLink stylesheet)
Adds a link to load a CSS stylesheet.


addScript

void addScript(InitializationPriority priority,
               String script)
Adds JavaScript code. The code is collected into a single block that is injected just before the close body tag of the page (in a full page render) and collected as the "script" property of the partial page render response. The JavaScript is executed after the page loads (or in an Ajax update, after external JavaScript libraries are loaded and the DOM is updated).

This method may be called multiple times for the same priority and the script will be accumulated.

Parameters:
priority - when to execute the provided script
script - statement to add to the block (a newline will be appended as well)

setInitialization

void setInitialization(InitializationPriority priority,
                       JSONObject initialization)
Adds a call to the Tapestry.init() function. This may be called multiple times and the init() calls will occur in order. In a normal page render, the init() calls will be added to the main JavaScript block, but in a partial page render Ajax response, the initialization will be property "init" of the partial page render response.

This method should only be invoked at most once per priority.

Since:
5.2.0


Copyright © 2003-2012 The Apache Software Foundation.