com.ibm.xsp.util
Class JSUtil

java.lang.Object
  extended by com.ibm.xsp.util.JSUtil

public class JSUtil
extends java.lang.Object

Some basic client side JavaScript utilities.


Constructor Summary
JSUtil()
           
 
Method Summary
static void addBoolean(java.lang.StringBuilder b, boolean value)
          Add a boolean value as part of the string your building
static void addDouble(java.lang.StringBuilder b, double value)
          Add a number as part of the string your building
static void addInt(java.lang.StringBuilder b, int value)
          Add a number as part of the string your building
static void addLong(java.lang.StringBuilder b, long value)
          Add a number as part of the string your building
static void addMessage(java.lang.StringBuilder b, java.lang.String s)
          Same as addString except the string is translated text which will not contain any backslashes (\)
static void addNumber(java.lang.StringBuilder b, java.lang.Number value)
          Add a number as part of the string your building
static void addString(java.lang.StringBuilder b, java.lang.String s)
          Add a string to a javascript string being constructed
static void addVariable(java.lang.StringBuilder buildingString, java.lang.String variableName)
          Adds a variable parameter for passing to a javascript function
static void appendJavaScriptString(java.lang.StringBuilder b, java.lang.String s)
          Utility for changing a string so that its compatbile in javascript and does not prevent backslashes
static void appendJavaScriptString(java.lang.StringBuilder b, java.lang.String s, boolean preventBackslash)
          Utility for changing a string so that its compatbile in javascript
static java.lang.String toJavaScriptString(java.lang.String s)
          Utility for changing a string so that its compatbile in javascript
static void writeln(javax.faces.context.ResponseWriter writer)
          Writes out a "/n"
static void writelnAfterStartTag(javax.faces.context.ResponseWriter writer)
          Writes out a "/n", differs from writeln because it closes the start tag,
static void writeTextBlank(javax.faces.context.ResponseWriter writer)
          Used to emit a space
static void writeTextBlank(javax.faces.context.ResponseWriter writer, int count)
          Used to emit a space
static void writeTextln(javax.faces.context.ResponseWriter writer)
          Just calls writelnAfterStartTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSUtil

public JSUtil()
Method Detail

addMessage

public static void addMessage(java.lang.StringBuilder b,
                              java.lang.String s)
Same as addString except the string is translated text which will not contain any backslashes (\)

Parameters:
buildingString - String being constructed
String - string to be added when its translated

addString

public static void addString(java.lang.StringBuilder b,
                             java.lang.String s)
Add a string to a javascript string being constructed

Parameters:
buildingString - String being constructed
String - string to be added when its converted

addVariable

public static void addVariable(java.lang.StringBuilder buildingString,
                               java.lang.String variableName)
Adds a variable parameter for passing to a javascript function

Parameters:
buildingString - String being constructed
variableName - Name of variable to add

addInt

public static void addInt(java.lang.StringBuilder b,
                          int value)
Add a number as part of the string your building

Parameters:
buildingString - String being constructed
integer - you want to add

addLong

public static void addLong(java.lang.StringBuilder b,
                           long value)
Add a number as part of the string your building

Parameters:
buildingString - String being constructed
Long - you want to add

addDouble

public static void addDouble(java.lang.StringBuilder b,
                             double value)
Add a number as part of the string your building

Parameters:
buildingString - String being constructed
double - you want to add

addBoolean

public static void addBoolean(java.lang.StringBuilder b,
                              boolean value)
Add a boolean value as part of the string your building

Parameters:
buildingString - String being constructed
boolean - you want to add

addNumber

public static void addNumber(java.lang.StringBuilder b,
                             java.lang.Number value)
Add a number as part of the string your building

Parameters:
buildingString - String being constructed
Number - the number you want to add

appendJavaScriptString

public static void appendJavaScriptString(java.lang.StringBuilder b,
                                          java.lang.String s)
Utility for changing a string so that its compatbile in javascript and does not prevent backslashes

Parameters:
StringBuilder -
string - converted to comply with javascript

appendJavaScriptString

public static void appendJavaScriptString(java.lang.StringBuilder b,
                                          java.lang.String s,
                                          boolean preventBackslash)
Utility for changing a string so that its compatbile in javascript

Parameters:
buildingString - String being constructed
string - converted to comply with javascript
preventBackslash -

toJavaScriptString

public static java.lang.String toJavaScriptString(java.lang.String s)
Utility for changing a string so that its compatbile in javascript

Parameters:
String - to convert
Returns:
string converted to comply with javascript

writeln

public static void writeln(javax.faces.context.ResponseWriter writer)
                    throws java.io.IOException
Writes out a "/n"

Parameters:
writer - ResponseWriter
Throws:
java.io.IOException

writelnAfterStartTag

public static void writelnAfterStartTag(javax.faces.context.ResponseWriter writer)
                                 throws java.io.IOException
Writes out a "/n", differs from writeln because it closes the start tag,

Parameters:
writer - ResponseWriter
Throws:
java.io.IOException

writeTextln

public static void writeTextln(javax.faces.context.ResponseWriter writer)
                        throws java.io.IOException
Just calls writelnAfterStartTag

Parameters:
writer - ResponseWriter
Throws:
java.io.IOException

writeTextBlank

public static void writeTextBlank(javax.faces.context.ResponseWriter writer)
                           throws java.io.IOException
Used to emit a space

Parameters:
writer - ResponseWriter
Throws:
java.io.IOException

writeTextBlank

public static void writeTextBlank(javax.faces.context.ResponseWriter writer,
                                  int count)
                           throws java.io.IOException
Used to emit a space

Parameters:
writer - ResponseWriter
count -
Throws:
java.io.IOException