org.jclientpages.page
Interface ClientPage

All Known Implementing Classes:
AbstractClientPage, BshClientPage

public interface ClientPage

This is the main interface that every compiled JClientPage implements

Author:
Luigi Dell'Aquila (luigi.dellaquila--at--gmail.com)

Method Summary
 void alert(java.lang.String alertString)
          displays an alert with the given string in the current window (blocking)
 java.lang.Object call(java.lang.String functionName, java.lang.Object[] args)
          invokes a JavaScript function in the current window
 java.lang.Boolean confirm(java.lang.String confirmString)
          displays a confirm dialog box (blocking)
 ClientPageNode createElement(java.lang.String tagName)
          creates a new DOM element
 ClientPageNode createTextNode(java.lang.String text)
          creates a new DOM text element
 java.lang.Object eval(java.lang.String iString)
          evaluates a JavaScript expression in the current window
 java.lang.Object executeInternal(java.lang.String methodName, java.lang.Object[] args)
          this method is used by the JCP implementation to reflectively invoke a method of the page
 ClientPageNode getElementById(java.lang.String id)
          searches for a node given its HTML id
 ClientPageNode[] getElementsByExpression(java.lang.String exp)
          searches for nodes evaluating a JavaScript expression (that returns an array of nodes).
 ClientPageNode[] getElementsByName(java.lang.String name)
          searches for nodes given an HTML name
IMPORTANT - due to a IE7 bug (and our workaround...) in some cases this method is a bit slow...
 ClientPageNode[] getElementsByTagName(java.lang.String name)
          searches for nodes given an HTML tag name
 java.util.List<MethodDescriptor> getMethods()
          returns a list of descriptors representing all the methods declared in the page (for internal use)
 netscape.javascript.JSObject getWindow()
          returns the JSObject representing the current window
 void init()
          is invoked by the JCP engine when the page is compiled and instantiated
 void onLoad()
          is invoked by the JCP engine when the page is loaded, immediately after the init() method.
 void setWindow(netscape.javascript.JSObject window)
           
 

Method Detail

onLoad

void onLoad()
is invoked by the JCP engine when the page is loaded, immediately after the init() method.
A JClientPage can override this method in order to execute custom code after page load


init

void init()
is invoked by the JCP engine when the page is compiled and instantiated


getWindow

netscape.javascript.JSObject getWindow()
returns the JSObject representing the current window

Returns:
the JSObject representing the current window

setWindow

void setWindow(netscape.javascript.JSObject window)

getElementById

ClientPageNode getElementById(java.lang.String id)
searches for a node given its HTML id

Parameters:
id - the HTML id of the node
Returns:
the node, null if no element with the given id exists in the page

getElementsByName

ClientPageNode[] getElementsByName(java.lang.String name)
searches for nodes given an HTML name
IMPORTANT - due to a IE7 bug (and our workaround...) in some cases this method is a bit slow...

Parameters:
name - the name of the nodes
Returns:
an array of nodes having the given name, a zero elements array if no node exists with the given name or given name is null

getElementsByTagName

ClientPageNode[] getElementsByTagName(java.lang.String name)
searches for nodes given an HTML tag name

Parameters:
name - the tag name of the nodes
Returns:
an array of nodes having the given tag name, a zero elements array if no node exists with the given tag name or given tag name is null

getElementsByExpression

ClientPageNode[] getElementsByExpression(java.lang.String exp)
searches for nodes evaluating a JavaScript expression (that returns an array of nodes). This method can be useful to integrate JClientPages with other JavaScript frameworks (such as JQuery...)

Parameters:
exp - the expression to be evaluated
Returns:
an array of resulting nodes

createElement

ClientPageNode createElement(java.lang.String tagName)
creates a new DOM element

Parameters:
tagName - the tag name
Returns:
the new element

createTextNode

ClientPageNode createTextNode(java.lang.String text)
creates a new DOM text element

Parameters:
text - the content of the text element
Returns:
the new element

call

java.lang.Object call(java.lang.String functionName,
                      java.lang.Object[] args)
invokes a JavaScript function in the current window

Parameters:
functionName - the function name
args - the function arguments
Returns:
the value returned by the function call

eval

java.lang.Object eval(java.lang.String iString)
evaluates a JavaScript expression in the current window

Parameters:
iString - the expression to be evaluated
Returns:
the result of the expression evaluation

alert

void alert(java.lang.String alertString)
displays an alert with the given string in the current window (blocking)

Parameters:
alertString -

confirm

java.lang.Boolean confirm(java.lang.String confirmString)
displays a confirm dialog box (blocking)

Parameters:
confirmString - the text displayed in the dialog
Returns:
true if the user clicked on OK button, false otherwise

executeInternal

java.lang.Object executeInternal(java.lang.String methodName,
                                 java.lang.Object[] args)
this method is used by the JCP implementation to reflectively invoke a method of the page

Parameters:
methodName - the method name
args - the method arguments
Returns:
the result of the method invocation

getMethods

java.util.List<MethodDescriptor> getMethods()
returns a list of descriptors representing all the methods declared in the page (for internal use)

Returns:
a list of descriptors representing all the methods declared in the page