org.apache.tapestry5.internal.services
Class PartialMarkupDocumentLinker

java.lang.Object
  extended by org.apache.tapestry5.internal.services.PartialMarkupDocumentLinker
All Implemented Interfaces:
DocumentLinker

public class PartialMarkupDocumentLinker
extends Object
implements DocumentLinker


Constructor Summary
PartialMarkupDocumentLinker()
           
 
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 commit(JSONObject reply)
          Commits changes, adding one or more keys to the reply.
 void setInitialization(InitializationPriority priority, JSONObject initialization)
          Adds a call to the Tapestry.init() function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PartialMarkupDocumentLinker

public PartialMarkupDocumentLinker()
Method Detail

addScriptLink

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

Specified by:
addScriptLink in interface DocumentLinker

addStylesheetLink

public void addStylesheetLink(StylesheetLink stylesheet)
Description copied from interface: DocumentLinker
Adds a link to load a CSS stylesheet.

Specified by:
addStylesheetLink in interface DocumentLinker

addScript

public void addScript(InitializationPriority priority,
                      String script)
Description copied from interface: DocumentLinker
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.

Specified by:
addScript in interface DocumentLinker
Parameters:
priority - when to execute the provided script
script - statement to add to the block (a newline will be appended as well)

setInitialization

public void setInitialization(InitializationPriority priority,
                              JSONObject initialization)
Description copied from interface: DocumentLinker
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.

Specified by:
setInitialization in interface DocumentLinker

commit

public void commit(JSONObject reply)
Commits changes, adding one or more keys to the reply.

Parameters:
reply - JSON Object to be sent to client


Copyright © 2003-2012 The Apache Software Foundation.