public class

PageResourceManager

extends Object
implements EnumPageResourceManagerModes
java.lang.Object
   ↳ com.microstrategy.web.app.utils.PageResourceManager

Class Overview

This class represents the resource manager associated with the page. It is used for managing the resources like JavaScript/CSS for the page.

Summary

[Expand]
Inherited Constants
From interface com.microstrategy.web.app.utils.EnumPageResourceManagerModes
Public Constructors
PageResourceManager()
Default Constructor.
Public Methods
void addBundle(String fileName, boolean includeInHead)
Add a JS bundle to the manager.
void addInterScriptFileDependency(String fromScriptFileName, String toScriptFileName)
This method programmatically specify a dependency relationship between two JavaScript files.
void addScript(MarkupOutput mo)
Add a scriptlet to the manager.
void addScript(StringBuilder script)
Add a scriptlet to the manager.
void addScriptFile(String fileName, boolean includeInHead)
Add a script file to the manager.
List<String> getAllBundles()
Iterator<String> getAllBundlesAsIterator()
List<String> getBundles(boolean includeInHead)
Returns an iterator over the list of JS Bundles.
Iterator<String> getBundlesAsIterator(boolean includeInHead)
Iterator<String> getScriptFiles(boolean includeInHead)
Iterator<String> getScriptFilesNotSorted(boolean includeInHead)
Returns an iterator over the list of files.
Iterator<StringBuilder> getScripts()
Returns an iterator over the list of scriptlets.
List<String> getTailUniqueFiles(boolean isDebugMode)
build a list of unique files to be included in document body steps 1.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PageResourceManager ()

Default Constructor.

Public Methods

public void addBundle (String fileName, boolean includeInHead)

Add a JS bundle to the manager.

Parameters
fileName - name of the JavaScript Bundle file.
includeInHead - whether it is needed at the head section of the page

public void addInterScriptFileDependency (String fromScriptFileName, String toScriptFileName)

This method programmatically specify a dependency relationship between two JavaScript files. If JavaScrit file B.js depends on A.js, then the A.js will be regarded as "fromScriptFileName", the B.js will be regarded as the "toScriptFileName". This relationship is represented by a graph. Normally, JavaScriptDependencyAnalyzer can automatically capture most dependency relationships in our JavaScript library by analyzing JavaScript source codes. When it comes to few exceptions that the dependency relationship is unable to be captured, we need to invoke this method to explicitly specify the relationship between two JavaScript files. More importantly, you can use this method to define different relationships on the same file in different pages.

Parameters
fromScriptFileName - the file name of the JavaScript file which is at the "from" end
toScriptFileName - the file name of the JavaScript file which is at the "to" end

public void addScript (MarkupOutput mo)

Add a scriptlet to the manager.

Parameters
mo - MarkupOutput - body of the script tag

public void addScript (StringBuilder script)

Add a scriptlet to the manager.

Parameters
script : StringBuilder - body of the script tag.

public void addScriptFile (String fileName, boolean includeInHead)

Add a script file to the manager.

Parameters
fileName - name of the JavaScript file.
includeInHead - whether it is needed at the head section of the page

public List<String> getAllBundles ()

public Iterator<String> getAllBundlesAsIterator ()

public List<String> getBundles (boolean includeInHead)

Returns an iterator over the list of JS Bundles.

public Iterator<String> getBundlesAsIterator (boolean includeInHead)

public Iterator<String> getScriptFiles (boolean includeInHead)

public Iterator<String> getScriptFilesNotSorted (boolean includeInHead)

Returns an iterator over the list of files.

Parameters
includeInHead : Boolean - files to be included in the head section of the page.
Returns
  • Iterator - list of files added to the resource manager.

public Iterator<StringBuilder> getScripts ()

Returns an iterator over the list of scriptlets.

Returns
  • Iterator - list of scriptlets added to the resource manager.

public List<String> getTailUniqueFiles (boolean isDebugMode)

build a list of unique files to be included in document body steps 1. build a list of unique files in all HEAD Bundles 2. build a list of unique files in all HeAD/TAIL Bundles 3. for dynamic files that are depends-sorted, remove all dependency files that are in the list of unique files built at step 2. now the result of step 3 is the list of files to be included as 'tail' files.

Parameters
isDebugMode Flag Indicating whether JS bundles are requested in debug mode.
Returns
  • List