|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Optional page control interface for controls that take advantage of JavaScript.
Method Summary | |
void |
generateFunction(String func,
Writer writer)
Invoked for every function or method name returned by getFunctionNames() and getMethodNames() . |
void |
generateRepaintScript(String namespace,
Writer writer,
String objectref)
Generates the script for updating the value of the control. |
void |
generateScriptInitializers(String namesapce,
Writer writer)
Generates the script to be inserted into the page loaded event handler. |
boolean |
getEnableHTMLGeneration()
Returns whether this control will generate HTML. |
String |
getFunctionNameForMethod(String methodname)
Returns the function name of the specified methods. |
String[] |
getFunctionNames()
Returns the names of the JavaScript methods used by this control. |
String[] |
getMethodNames()
Returns the names of the JavaScript methods used by this control. |
String |
getScriptObjectName(String namespace)
Returns a string that gives the scriptable element reference. |
boolean |
isHTMLRepaintPending()
Returns whether the state of this control needs a complete HTML generation to refresh. |
boolean |
isJavaScriptRepaintPending()
Returns whether the state of this control needs to be updated to the browser. |
Method Detail |
public String[] getFunctionNames()
The difference between functions and methods is that methods are part of the JavaScript object representing this control. Therefore, methods are invoked differently.
For example, if this object is called
"Button1" on the page, then a method such
as "flash" is invoked by
"this.Button1.flash()
" in a page method.
AgiJavaScriptEnhanced.getFunctionNameForMethod(String methodname)
,
AgiJavaScriptEnhanced.getFunctionNames()
public void generateFunction(String func, Writer writer) throws IOException
getFunctionNames()
and getMethodNames()
.
Implementation of this method should generate the script for the specified
JavaScript function.func
- A string naming the function.writer
- A character output stream.Refer to getFunctionNames() for convention of naming functions.
The following Java code generates a Javascript function named "com_sssw_ShowHelloWorld" which brings up an alert dialog.
writer.write("\nfunction com_sssw_ShowHelloWorld() {alert('Hello World');}");
public String[] getMethodNames()
The difference between functions and methods is that methods are part of the JavaScript object representing this control. Therefore, methods are invoked differently.
For example, if this object is called
"Button1" on the page, then a method such
as "flash" is invoked by
"this.Button1.flash()
" in a page method.
AgiJavaScriptEnhanced.getFunctionNameForMethod(String methodname)
,
AgiJavaScriptEnhanced.getFunctionNames()
public String getFunctionNameForMethod(String methodname)
methodname
- a string representing the method name.AgiJavaScriptEnhanced.getFunctionNames()
,
AgiJavaScriptEnhanced.getMethodNames()
public String getScriptObjectName(String namespace)
namespace
- a string representing the namespace.
It should be a document-relative reference. For example, if the JavaScript
object of this control can be referenced by
document.forms[0].elements["S5_"]
,
then forms[0].elements["S5_"]
should be returned.
Note that in some situations, the control may not be in the first form in a page, controls should generally ask the page for the form reference.
public boolean isHTMLRepaintPending()
This method is used only with the script-based repaint mode, not currently implemented in SilverStream 2.0. This method name is reserved for future release. Custom page controls designed for SilverStream 2.0 should always return true.
AgiJavaScriptEnhanced.generateRepaintScript(String namespace, Writer writer, String objectref)
,
AgiJavaScriptEnhanced.isJavaScriptRepaintPending()
public boolean isJavaScriptRepaintPending()
This method is used only with the script-based repaint mode, not currently implemented in SilverStream 2.0. This method name is reserved for future release. Custom page controls designed for SilverStream 2.0 should always return true.
AgiJavaScriptEnhanced.isHTMLRepaintPending()
public void generateRepaintScript(String namespace, Writer writer, String objectref) throws IOException
namespace
- a string containing the namespace.writer
- a character output stream.objectref
- a string referencing the object.This method is used only with the script-based repaint mode, not currently implemented in SilverStream 2.0. This method name is reserved for future release. Custom page controls designed for SilverStream 2.0 should simply do nothing and return.
This method will get called only if every control on the page reports false to isHTMLRepaintPending and, this control indicates that JavaScriptRepaint is pending. You can use the objectref to refer to this object.
AgiJavaScriptEnhanced.isHTMLRepaintPending()
public boolean getEnableHTMLGeneration()
public void generateScriptInitializers(String namesapce, Writer writer) throws IOException
namesapce
- a string containing the namespace.writer
- a character output stream.Use this method to generate any scripts that need to go into the page loaded event. For example, controls can generate scripts to preload the images needed in the actual HTML.
The following Java code generates JavaScript that preloads an image.
writer.write(" (new Image()).src = \"someimage.gif\";");
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |