public class

ClientSideHelper

extends Object
java.lang.Object
   ↳ com.microstrategy.web.app.utils.ClientSideHelper

Class Overview

ClientSideHelper Provides utility functions used to provide a single code base for: 1) including javascript files, 2) registering bones, 3) setting bone properties

Summary

Public Constructors
ClientSideHelper(AppContext apc)
Public Methods
static void addInlineScript(MarkupOutput out, AppContext appContext, StringBuilder scriptBody)
Add an inline script in the page.
void addInterScriptClassDependency(String fromJsClassName, String toJsClassName)
Add a dependency between two JavaScript classes.
void addInterScriptFileDependency(String fromJsFileName, String toJsFileName)
Add a dependency between two JavaScript files.
void addScriptDependency(String filename, String loadCondition)
This method adds a script dependency for a bone.
void addScriptDependency(String jsClassName)
void generateAppendToBoneJS(MarkupOutput out, String id)
This method renders script loading tags and bone property append
void generateAppendToBoneJS(MarkupOutput out, String id, boolean encode)
This method renders script loading tags and bone property append.
void generateRegisterBoneJS(MarkupOutput out, String id)
This method renders script loading tags and bone registration.
void generateUpdateBoneJS(MarkupOutput out, String id)
This method renders script loading tags and bone update.
JsonGenerator getBonePropertiesGenerator()
This method returns the internal JsonGenerator used to render the bones properties.
static boolean usePageResourceManagerForScripts(AppContext appContext)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ClientSideHelper (AppContext apc)

Parameters
apc AppContext

Public Methods

public static void addInlineScript (MarkupOutput out, AppContext appContext, 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
scriptBody - Content of the script.

public void addInterScriptClassDependency (String fromJsClassName, 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.

public void addInterScriptFileDependency (String fromJsFileName, 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.

public void addScriptDependency (String filename, 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.

public void addScriptDependency (String jsClassName)

public void generateAppendToBoneJS (MarkupOutput out, 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)

public void generateAppendToBoneJS (MarkupOutput out, 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

public void generateRegisterBoneJS (MarkupOutput out, 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)

public void generateUpdateBoneJS (MarkupOutput out, 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)

public JsonGenerator getBonePropertiesGenerator ()

This method returns the internal JsonGenerator used to render the bones properties.

Returns

public static boolean usePageResourceManagerForScripts (AppContext appContext)