www.element4solution.com

e4s.html
Class E4JavaScript

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.html.E4JavaScriptIncludes
          extended by e4s.html.E4JavaScript
All Implemented Interfaces:
E4JavaScript_Intf
Direct Known Subclasses:
E4EventHandler

public class E4JavaScript
extends E4JavaScriptIncludes
implements E4JavaScript_Intf

Java-Script handling. A Java-Script is a piece of script coding that has a name (name of the function). It can be included to most of the HTML elements, e.g. to a >TD< element. The e4s then collects all scripts to the topmost element, normally this will be a >HTML< element and print out the scripts into the HTML code. If a script will be collected using the same name, then it is ignored. Event handlers (E4EventHandler_Intf) are also Java Scripts, but they include an activating trigger and are related to their base element, e.g. E4EventHandlerA is related to A.

Since:
JDK 1.4
See Also:
E4EventHandler_Intf, E4HtmlElement_Intf.addScript(E4JavaScript_Intf), E4HtmlElementGeneral.addScript(E4JavaScript_Intf), E4HtmlElementGeneral.createScript(), E4ScriptsVec, {@tutorial Example_E4JavaScript}

Nested Class Summary
static class E4JavaScript.E4JavaScriptException
           
static class E4JavaScript.JSBODY
          Body part of the E4JavaScript (between the function declaration and the closing bracket, but excluding the opening bracket).
static class E4JavaScript.JSIF
           
static class E4JavaScript.JSIFNOELSE
           
static class E4JavaScript.JSRETURN
           
static class E4JavaScript.JSTRY
           
static class E4JavaScript.JSVAR
           
 
Field Summary
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Constructor Summary
E4JavaScript()
           
E4JavaScript(E4JavaScript js)
           
E4JavaScript(java.lang.String name)
           
 
Method Summary
static java.lang.String _getSVNVersionString()
          Get version info string from subversion.
 void append_alert(Language lang_dest, E4Label_Intf label)
          Add a line in the style "alert('xyz');" to the script's function body.
 void append(java.lang.String s)
          Append a String to the function's body, no line-break.
 void appendln()
          Add a line break to the script's body.
 void appendln(java.lang.String line)
          Append a String to the function's body, the line will be terminated using E4Object.CRLF to create a line break.
 E4JavaScript.JSBODY body()
          Deprecated.  
 void clear()
           
static java.lang.String Escape(Language lang_dest, E4Label_Intf label)
          Change ' into \', " into \" and \ into \\ to be E4JavaScript compatible.
static java.lang.String Escape(Language dest_lang, E4Label_Intf label, boolean special_chars)
          Change ' into \', " into \" and \ into \\ to be E4JavaScript compatible.
static java.lang.String Escape(java.lang.String s)
          Change ' into \', " into \" and \ into \\ to be E4JavaScript compatible.
static java.lang.String Escape(java.lang.String s, boolean special_chars)
          Change ' into \', " into \" and \ into \\ to be E4JavaScript compatible.
 java.lang.StringBuffer getFunctionBody()
          Get the function's body.
 java.lang.String getName()
          Get the name of the E4JavaScript.
 boolean hasFunctionBody()
          Get the code size.
 boolean isInline()
          Inline means, that the script is included in the HTML page after script collection.
 E4JavaScript.JSBODY JSBODY()
          Create a JavaScript's body
 void resetBuffer()
          Reset the function's body.
static E4JavaScript resizeWindow(java.lang.String window_id)
           
 void setName(java.lang.String name)
          Sets the name, avoiding special characters.
 java.lang.String toString()
           
 
Methods inherited from class e4s.html.E4JavaScriptIncludes
addScript, getAdditionalScripts
 
Methods inherited from class e4s.util.E4Object
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, finalize, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface e4s.html.E4JavaScript_Intf
getAdditionalScripts
 

Constructor Detail

E4JavaScript

public E4JavaScript(java.lang.String name)

E4JavaScript

public E4JavaScript(E4JavaScript js)

E4JavaScript

public E4JavaScript()
Method Detail

setName

public void setName(java.lang.String name)
Sets the name, avoiding special characters.

Parameters:
name - if null, a generic name will be used
See Also:
getName()

body

public E4JavaScript.JSBODY body()
Deprecated. 

See Also:
JSBODY()

JSBODY

public E4JavaScript.JSBODY JSBODY()
Create a JavaScript's body


getName

public java.lang.String getName()
Get the name of the E4JavaScript. This is either an explicit name defined on instanciating or it can be a generic name if no name was specified.

Specified by:
getName in interface E4JavaScript_Intf
Returns:
the name of the E4JavaScript funtion

resetBuffer

public void resetBuffer()
Reset the function's body.

See Also:
getFunctionBody()

append

public void append(java.lang.String s)
Append a String to the function's body, no line-break. String s statements to be appended

See Also:
appendln(String), appendln(), append_alert(e4s.application.Language, e4s.translate.E4Label_Intf)

appendln

public void appendln(java.lang.String line)
Append a String to the function's body, the line will be terminated using E4Object.CRLF to create a line break. String line line to be appended

See Also:
append(String), appendln(), append_alert(e4s.application.Language, e4s.translate.E4Label_Intf)

appendln

public void appendln()
Add a line break to the script's body. String line line to be appended

See Also:
appendln(String)

append_alert

public void append_alert(Language lang_dest,
                         E4Label_Intf label)
Add a line in the style "alert('xyz');" to the script's function body. Special characters within the text (label) will be replaced. String label message to appear in the alert statement of the script

See Also:
appendln(String), append(String)

getFunctionBody

public java.lang.StringBuffer getFunctionBody()
Get the function's body.

Returns:
the E4JavaScript's body (including statements collected by e.g. appendln(String))
See Also:
resetBuffer()

resizeWindow

public static E4JavaScript resizeWindow(java.lang.String window_id)

toString

public java.lang.String toString()
Overrides:
toString in class E4Object

Escape

public static java.lang.String Escape(Language lang_dest,
                                      E4Label_Intf label)
Change ' into \', " into \" and \ into \\ to be E4JavaScript compatible.

Parameters:
label - the translated String to be replaced
Returns:
the replaced String, or null if label was null

Escape

public static java.lang.String Escape(Language dest_lang,
                                      E4Label_Intf label,
                                      boolean special_chars)
Change ' into \', " into \" and \ into \\ to be E4JavaScript compatible.

Parameters:
label - the translated String to be replaced
special_chars - true, also change ü,ö,ä,ß as there might be problems using UTF-8 output
Returns:
the replaced String, or null if label was null

Escape

public static java.lang.String Escape(java.lang.String s)
Change ' into \', " into \" and \ into \\ to be E4JavaScript compatible.

Parameters:
s - the String to be replaced
Returns:
the replaced String, or null if s was null

Escape

public static java.lang.String Escape(java.lang.String s,
                                      boolean special_chars)
Change ' into \', " into \" and \ into \\ to be E4JavaScript compatible.

Parameters:
s - the String to be replaced
special_chars - true, also change ü,ö,ä,ß as there might be problems using UTF-8 output
Returns:
the replaced String, or null if s was null

isInline

public boolean isInline()
Inline means, that the script is included in the HTML page after script collection.

Specified by:
isInline in interface E4JavaScript_Intf
Returns:
true always.

hasFunctionBody

public boolean hasFunctionBody()
Get the code size.

Specified by:
hasFunctionBody in interface E4JavaScript_Intf
Returns:
the code size (number of characters)

clear

public void clear()

_getSVNVersionString

public static java.lang.String _getSVNVersionString()
Get version info string from subversion.

Returns:
the version info string.
See Also:
E4Util.getRevisionCodeFromSVN(Class)

www.element4solution.com