Class ClientSideHelper


  • public class ClientSideHelper
    extends java.lang.Object
    ClientSideHelper Provides utility functions used to provide a single code base for: 1) including javascript files, 2) registering bones, 3) setting bone properties
    Since:
    MicroStrategy Web 8.0.0
    • Constructor Detail

    • Method Detail

      • addScriptDependency

        public void addScriptDependency​(java.lang.String filename,
                                        java.lang.String loadCondition)
        This method adds a script dependency for a bone. Registration of a bone with a script dependency will be held until all script file dependencies have been resolved (loaded).
        Parameters:
        filename - String the name of the script file
        loadCondition - String a JavaScript string that when evaluated (using the eval function) will return true when the file is loaded.
      • addScriptDependency

        public void addScriptDependency​(java.lang.String jsClassName)
        Since:
        MicroStrategy Web 9.0.0
      • addInterScriptFileDependency

        public void addInterScriptFileDependency​(java.lang.String fromJsFileName,
                                                 java.lang.String toJsFileName)
        Add a dependency between two JavaScript files. Usage Note: By the definition specified in the DAG.java, the "to" JavaScript depends on the "from" JavaScript. So if you want to ensure "a.js" appear before "b.js" in a web page, then you should call this method as 'addInterScriptFileDependency("a.js", "b.js")'.
        Parameters:
        fromJsFileName - String the "parent" JavaScript file name that should appear before the toJSFileName in the page.
        toJsFileName - String the "dependent" JavaScript file name that should appear after the fromJSFileName in the page.
        Since:
        MicroStrategy Web 9.0.1
      • addInterScriptClassDependency

        public void addInterScriptClassDependency​(java.lang.String fromJsClassName,
                                                  java.lang.String toJsClassName)
        Add a dependency between two JavaScript classes. Usually, Web Transforms only take care of JS class name information, while they are ignorant of the .js file namas. It is desirable for Web Transforms only pass into this method the JavaScript class information, rather than .js file name information. So this method is being provided in addition to the addInterScriptFileDependency. Usage Note: By the definition specified in the DAG.java, the "to" JavaScript depends on the "from" JavaScript. So if you want to ensure JS Class "A" appear before JS Class "B" in a web page, then you should call this method as 'addInterScriptClassDependency("A", "B")'.
        Parameters:
        fromJsClassName - String the "parent" JavaScript class name that should appear before the toJSClassName in the page.
        toJsClassName - String the "dependent" JavaScript class name that should appear after the fromJsClassName in the page.
        Since:
        MicroStrategy Web 9.0.1
      • getBonePropertiesGenerator

        public JsonGenerator getBonePropertiesGenerator()
        This method returns the internal JsonGenerator used to render the bones properties.
        Returns:
        JsonGenerator
      • generateRegisterBoneJS

        public void generateRegisterBoneJS​(MarkupOutput out,
                                           java.lang.String id)
        This method renders script loading tags and bone registration.
        Parameters:
        out - MarkupOutput that receives the output html
        id - String the id of the main bone element (used for registration)
      • generateUpdateBoneJS

        public void generateUpdateBoneJS​(MarkupOutput out,
                                         java.lang.String id)
        This method renders script loading tags and bone update.
        Parameters:
        out - MarkupOutput that receives the output html
        id - String the id of the main bone element (used for registration)
        Since:
        MicroStrategy Web 9.0.0
      • generateAppendToBoneJS

        public void generateAppendToBoneJS​(MarkupOutput out,
                                           java.lang.String id)
        This method renders script loading tags and bone property append
        Parameters:
        out - MarkupOutput that receives the output html
        id - String the id of the main bone element (used for registration)
        Since:
        MicroStrategy Web 9.0.1
      • generateAppendToBoneJS

        public void generateAppendToBoneJS​(MarkupOutput out,
                                           java.lang.String id,
                                           boolean encode)
        This method renders script loading tags and bone property append.
        Parameters:
        out - MarkupOutput that receives the output html
        id - String the id of the main bone element (used for registration)
        encode - boolean true if this rendering occurs within the context of a ComponentBlock, in which case the empty span tag will not be rendered so to preserve the correctness of the json syntax
      • addInlineScript

        public static void addInlineScript​(MarkupOutput out,
                                           AppContext appContext,
                                           java.lang.StringBuilder scriptBody)
        Add an inline script in the page. This method would delegate the rendering to the Page Resource Manager PageResourceManager if it is enabled. Otherwise, it renders a script tag and adds the scriptBody as the child of the tag.
        Parameters:
        out - - MarkupOut to use
        appContext -
        scriptBody - - Content of the script.
        Since:
        MicroStrategy Web 9.0.0
      • addInlineScript

        public static void addInlineScript​(MarkupOutput out,
                                           AppContext appContext,
                                           MarkupOutput scriptBodyMo)
        Add an inline script in the page. This method would delegate the rendering to the Page Resource Manager PageResourceManager if it is enabled. Otherwise, it renders a script tag and adds the scriptBody as the child of the tag.
        Parameters:
        out - - MarkupOut to use
        appContext -
        scriptBodyMo - - Content of the script as a MarkupOutput object.
        Since:
        MicroStrategy Web 9.0.0
      • usePageResourceManagerForScripts

        public static boolean usePageResourceManagerForScripts​(AppContext appContext)
        Since:
        MicroStrategy Web 9.0.0