Class DocumentLinkerImpl
java.lang.Object
org.apache.tapestry5.internal.services.DocumentLinkerImpl
- All Implemented Interfaces:
DocumentLinker
-
Constructor Summary
ConstructorsConstructorDescriptionDocumentLinkerImpl(ModuleManager moduleManager, boolean omitGeneratorMetaTag, boolean enablePageloadingMask, String tapestryVersion) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddContentToBody(Element body) Adds<script>elements for the RequireJS library, then any statically includes JavaScript libraries (including JavaScript stack virtual assets), then the initialization script block.voidaddCoreLibrary(String libraryURL) A special case used only for the libraries that are part of the core stack, which itself contains RequireJS and is used to bootstrap up to adding non-core libraries.voidaddInitialization(InitializationPriority priority, String moduleName, String functionName, JSONArray arguments) Adds initialization, based on invoking functions exported by JavaScript modules.voidaddLibrary(String libraryURL) Adds a link to load a non-core JavaScript library.voidAdds a module configuration callback for this request.voidaddScript(InitializationPriority priority, String script) Adds JavaScript code.voidaddStylesheetLink(StylesheetLink sheet) Adds a link to load a CSS stylesheet.protected voidaddStylesheetsToHead(Element root, List<StylesheetLink> stylesheets) Locates the head element under the root ("html") element, creating it if necessary, and adds the stylesheets to it.voidupdateDocument(Document document) Updates the supplied Document, possibly adding <head> or <body> elements.
-
Constructor Details
-
DocumentLinkerImpl
public DocumentLinkerImpl(ModuleManager moduleManager, boolean omitGeneratorMetaTag, boolean enablePageloadingMask, String tapestryVersion) - Parameters:
moduleManager- used to identify the root folder for dynamically loaded modulesomitGeneratorMetaTag- via symbol configurationenablePageloadingMask-tapestryVersion-
-
-
Method Details
-
addStylesheetLink
Description copied from interface:DocumentLinkerAdds a link to load a CSS stylesheet.- Specified by:
addStylesheetLinkin interfaceDocumentLinker
-
addCoreLibrary
Description copied from interface:DocumentLinkerA special case used only for the libraries that are part of the core stack, which itself contains RequireJS and is used to bootstrap up to adding non-core libraries.- Specified by:
addCoreLibraryin interfaceDocumentLinker
-
addLibrary
Description copied from interface:DocumentLinkerAdds a link to load a non-core JavaScript library. These libraries are loaded, sequentially, only once the core libraries have loaded and initialized. Thus difference between core libraries and other libraries is new in 5.4, and represents a conflict between asynchronous loading of modules (introduced in 5.4) and sequential loading of libraries (in 5.3 and earlier).- Specified by:
addLibraryin interfaceDocumentLinker
-
addScript
Description copied from interface:DocumentLinkerAdds 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:
addScriptin interfaceDocumentLinker- Parameters:
priority- when to execute the provided scriptscript- statement to add to the block (a newline will be appended as well)
-
addInitialization
public void addInitialization(InitializationPriority priority, String moduleName, String functionName, JSONArray arguments) Description copied from interface:DocumentLinkerAdds initialization, based on invoking functions exported by JavaScript modules.- Specified by:
addInitializationin interfaceDocumentLinker- Parameters:
priority- priority at which to perform initializationmoduleName- name of module; the module exports a single function, or a map of functionsfunctionName- name of function exported by module, or null (if the module exports a single function)arguments- arguments to pass to the function, or null if no arguments
-
updateDocument
Updates the supplied Document, possibly adding <head> or <body> elements.- Parameters:
document- to be updated
-
addContentToBody
Adds<script>elements for the RequireJS library, then any statically includes JavaScript libraries (including JavaScript stack virtual assets), then the initialization script block.- Parameters:
body- element to add the dynamic scripting to
-
addStylesheetsToHead
Locates the head element under the root ("html") element, creating it if necessary, and adds the stylesheets to it.- Parameters:
root- element of documentstylesheets- to add to the document
-
addModuleConfigurationCallback
Description copied from interface:DocumentLinkerAdds a module configuration callback for this request.- Specified by:
addModuleConfigurationCallbackin interfaceDocumentLinker- Parameters:
callback- aModuleConfigurationCallback. It cannot be null.
-