com.plumtree.taskapi.portalui
Class TaskAPIUIJavascript

java.lang.Object
  extended by com.plumtree.taskapi.portalui.TaskAPIUIJavascript

public class TaskAPIUIJavascript
extends java.lang.Object

Javascript related TaskAPI functions.


Constructor Summary
TaskAPIUIJavascript()
           
 
Method Summary
static HTMLScript AddSafeJSStringVariable(java.lang.String strName, java.lang.String strValue)
          Helper function to define a safe javascript variable.
static HTMLScript AddSafeJSVariable(java.lang.String strName, java.lang.String strValue)
          Helper function to define a safe javascript variable.
static java.lang.String EscapeJavaScriptString(java.lang.String strJSString)
          Escapes a string to use with javascript.
static HTMLElementCollection GenerateJSComponentInclude(java.lang.String strComponentName, XPLocale locale, AActivitySpace owner)
          Generates javascript to include specified jscomponent onto the page.
static JS1DArrayBuilder GetJS1DArrayBuilder()
          Returns a new helper object to generate a String with javascript code to declare a one-dimensional array.
static JS2DArrayBuilder GetJS2DArrayBuilder(int nColumnCount)
          Returns a new helper object to generate a String with javascript code to declare a two-dimensional array.
static JSFunctionCallBuilder GetJSFunctionCallBuilder(java.lang.String strFunctionName)
           
static java.lang.String GetSafeJSVariable(java.lang.String strName)
          Helper function to retrieve a safe javascript variable.
static java.lang.String GetSafeJSVariableWarn(java.lang.String strName)
          Helper function to retrieve a safe javascript variable.
static HTMLScript InitializeSafeJSVarElements()
          Call this function to use SafeJSVars on a page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskAPIUIJavascript

public TaskAPIUIJavascript()
Method Detail

InitializeSafeJSVarElements

public static HTMLScript InitializeSafeJSVarElements()
Call this function to use SafeJSVars on a page. Create the container to hold the safe variables. The container is just a javascript object and we but the vars on it as object properties.

Returns:
HTMLScript Element with javascript to initialize SafeJSVars .

AddSafeJSVariable

public static HTMLScript AddSafeJSVariable(java.lang.String strName,
                                           java.lang.String strValue)
Helper function to define a safe javascript variable. The safe variable will be defined in its on javascript block, so it won't affect any other javascript if the assigned value is invalid. Reference it by using the javascript getSafeVariable or getSafeVariableWarn helper functions or GetSafeJSVariable or GetSafeJSVariableWarn java helper functions to generate the javascript calls. NOTE: The strValue is the string with the javascript value so don't surround it with quotes. For javascript string values, use the AddSafeJSStringVariable method. E.g. strValue = new Object() - will assign a new object to the variable while strValue = "new Object()" - will assign the string "new Object()"

Parameters:
strName - Name of the variable to create. Should be unqiue from other name on a page.
strValue - Value of the variable. Either a number or a reference to another javascript variable.
Returns:
HTMLScript Javascript element with javascript to create the specfied variable.
See Also:
AddSafeJSVariable, GetSafeJSVariable, GetSafeJSVariableWarn

AddSafeJSStringVariable

public static HTMLScript AddSafeJSStringVariable(java.lang.String strName,
                                                 java.lang.String strValue)
Helper function to define a safe javascript variable. The safe variable will be defined in its on javascript block, so it won't affect any other javascript if the assigned value is invalid. Reference it by using the javascript getSafeVariable or getSafeVariableWarn helper functions or GetSafeJSVariable or GetSafeJSVariableWarn java helper * functions to generate the javascript calls. Adds quotes around the provided String and escapes any quotes and whitespace in the string. For example, passing in 'Text' (without quotes) will create a javascript string with the value Text.

Parameters:
strName - Name of the variable to create. Should be unqiue from other name on a page.
strValue - String value of the variable.
Returns:
HTMLScript Javascript element with javascript to create the specfied variable.

GetSafeJSVariable

public static java.lang.String GetSafeJSVariable(java.lang.String strName)
Helper function to retrieve a safe javascript variable. The javascript function will return false if it is unable to get the variable.

Parameters:
strName - Name of the variable to retrieve.
Returns:
String A string with Javascript code to retrieve the named SafeJS variable. The String should be added to a HTMLScript element.
See Also:
InitializeSafeJSVarElements, AddSafeJSVariable, GetSafeJSVariableWarn

GetSafeJSVariableWarn

public static java.lang.String GetSafeJSVariableWarn(java.lang.String strName)
Helper function to retrieve a safe javascript variable. The javascript function will display a javascript alert error with the name of the variable. Use for critical variables that absolutely need to be defined for a page to function.

Parameters:
strName - Name of the variable to retrieve.
Returns:
String A string with Javascript code to retrieve the named SafeJS variable. The String should be added to a HTMLScript element.
See Also:
InitializeSafeJSVarElements, AddSafeJSVariable, GetSafeJSVariable

GetJSFunctionCallBuilder

public static JSFunctionCallBuilder GetJSFunctionCallBuilder(java.lang.String strFunctionName)
Parameters:
strFunctionName -
Returns:

GetJS1DArrayBuilder

public static JS1DArrayBuilder GetJS1DArrayBuilder()
Returns a new helper object to generate a String with javascript code to declare a one-dimensional array.

Returns:
JS1DArrayBuilder object.

GetJS2DArrayBuilder

public static JS2DArrayBuilder GetJS2DArrayBuilder(int nColumnCount)
Returns a new helper object to generate a String with javascript code to declare a two-dimensional array.

Parameters:
nColumnCount - Number of columns in the array.
Returns:
JS2DArrayBuilder object.

EscapeJavaScriptString

public static java.lang.String EscapeJavaScriptString(java.lang.String strJSString)
Escapes a string to use with javascript. Escapes characters such as carriage returns, tabs and < and >.

Parameters:
strJSString - String to escape.
Returns:
Escaped string or empty string if provided string is null.

GenerateJSComponentInclude

public static HTMLElementCollection GenerateJSComponentInclude(java.lang.String strComponentName,
                                                               XPLocale locale,
                                                               AActivitySpace owner)
Generates javascript to include specified jscomponent onto the page.

Parameters:
strComponentName - Name of the JSComponent. Constants for the JSComponents are defined in ConfigHelper.
locale - The locale to use in the jscomponent. Will affect language and date/time formats.
owner - Current Activityspace.
Returns:
HTMLElementCollection with a script element that includes the specified jscomponent.
See Also:
ConfigHelper



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.