NextApp Echo
App Container 1.1.4

nextapp.echoservlet.html
Class Script

java.lang.Object
  extended bynextapp.echoservlet.html.Script
All Implemented Interfaces:
Renderable, java.io.Serializable

public class Script
extends java.lang.Object
implements Renderable, java.io.Serializable

A container of JavaScript code. Provides the ability to add lines of JavaScript code that will be automatically indented correctly for the document in which they are rendered.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface nextapp.echoservlet.html.Renderable
INDENT_STRING
 
Constructor Summary
Script()
          Creates a new script object.
 
Method Summary
 void add(int tab, java.lang.String line)
          Adds a line of script code.
static java.lang.String encodeQuotedString(java.lang.String s)
          Encodes single and double quotation marks found in a String by backslash escaping them.
 void render(java.io.PrintWriter pw, int depth, boolean parentWhitespaceRelevant)
          Renders the renderable object to the given PrintWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Script

public Script()
Creates a new script object.

Method Detail

encodeQuotedString

public static java.lang.String encodeQuotedString(java.lang.String s)
Encodes single and double quotation marks found in a String by backslash escaping them.

Parameters:
s - The string to be encoded.
Returns:
The encoded string.

add

public void add(int tab,
                java.lang.String line)
Adds a line of script code. The line should not contain any newline characters.

Parameters:
tab - The tab index to which the line should be indented.
line - The line of code (with no leading spaces and no newline characters.

render

public void render(java.io.PrintWriter pw,
                   int depth,
                   boolean parentWhitespaceRelevant)
Description copied from interface: Renderable
Renders the renderable object to the given PrintWriter.

Specified by:
render in interface Renderable
Parameters:
pw - The PrintWriter to render to.
depth - The indentation depth that should be applied to the element being rendered.
parentWhitespaceRelevant - A flag that indicates whether the containing element is sensitive to white space.
See Also:
Renderable.render(PrintWriter, int, boolean)

NextApp Echo
App Container 1.1.4