Class PageResourceManager

  • All Implemented Interfaces:
    EnumPageResourceManagerModes

    public class PageResourceManager
    extends java.lang.Object
    implements EnumPageResourceManagerModes
    This class represents the resource manager associated with the page. It is used for managing the resources like JavaScript/CSS for the page.
    Since:
    MicroStrategy Web 9.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      PageResourceManager()
      Default Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addBundle​(java.lang.String fileName, boolean includeInHead)
      Add a JS bundle to the manager.
      void addInterScriptFileDependency​(java.lang.String fromScriptFileName, java.lang.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​(java.lang.StringBuilder script)
      Add a scriptlet to the manager.
      void addScriptFile​(java.lang.String fileName, boolean includeInHead)
      Add a script file to the manager.
      java.util.List<java.lang.String> getAllBundles()  
      java.util.Iterator<java.lang.String> getAllBundlesAsIterator()  
      java.util.List<java.lang.String> getBundles​(boolean includeInHead)
      Returns an iterator over the list of JS Bundles.
      java.util.Iterator<java.lang.String> getBundlesAsIterator​(boolean includeInHead)  
      java.util.Iterator<java.lang.String> getScriptFiles​(boolean includeInHead)  
      java.util.Iterator<java.lang.String> getScriptFilesNotSorted​(boolean includeInHead)
      Returns an iterator over the list of files.
      java.util.Iterator<java.lang.StringBuilder> getScripts()
      Returns an iterator over the list of scriptlets.
      java.util.List<java.lang.String> getTailUniqueFiles​(boolean isDebugMode)
      build a list of unique files to be included in document body steps 1.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PageResourceManager

        public PageResourceManager()
        Default Constructor.
    • Method Detail

      • addBundle

        public void addBundle​(java.lang.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
      • getBundles

        public java.util.List<java.lang.String> getBundles​(boolean includeInHead)
        Returns an iterator over the list of JS Bundles.
      • getBundlesAsIterator

        public java.util.Iterator<java.lang.String> getBundlesAsIterator​(boolean includeInHead)
      • getAllBundles

        public java.util.List<java.lang.String> getAllBundles()
      • getAllBundlesAsIterator

        public java.util.Iterator<java.lang.String> getAllBundlesAsIterator()
      • getTailUniqueFiles

        public java.util.List<java.lang.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
      • addScriptFile

        public void addScriptFile​(java.lang.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
      • addInterScriptFileDependency

        public void addInterScriptFileDependency​(java.lang.String fromScriptFileName,
                                                 java.lang.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
        Since:
        MicroStrategy Web 9.0.1
      • addScript

        public void addScript​(java.lang.StringBuilder script)
        Add a scriptlet to the manager.
        Parameters:
        script - : StringBuilder - body of the script tag.
      • addScript

        public void addScript​(MarkupOutput mo)
        Add a scriptlet to the manager.
        Parameters:
        mo - - MarkupOutput - body of the script tag
      • getScriptFilesNotSorted

        public java.util.Iterator<java.lang.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.
      • getScriptFiles

        public java.util.Iterator<java.lang.String> getScriptFiles​(boolean includeInHead)
      • getScripts

        public java.util.Iterator<java.lang.StringBuilder> getScripts()
        Returns an iterator over the list of scriptlets.
        Returns:
        Iterator - list of scriptlets added to the resource manager.