org.zkoss.zul.api
Interface Script

All Known Implementing Classes:
Script

public interface Script

A component to represent script codes running at the client. It is the same as HTML SCRIPT tag.

Note: it is the scripting codes running at the client, not at the server. Don't confuse it with the zscript element.

There are three formats when used in a ZUML page:

Method 1: Specify the URL of the JS file

 <code><script type="text/javascript" src="my.js"/>
 </code>
 

Method 2: Specify the JavaScript codes directly

 <code><script type="text/javascript">
 some_js_at_browser();
 </script>
 </code>
 

Method 3: Specify the JavaScript codes by use of the content property ( setContent(java.lang.String)).

 <code><script type="text/javascript">
 <attribute name="content">
  some_js_at_browser();
 </attribute>
 </script>
 </code>
 

Since:
3.5.2
Author:
tomyeh

Method Summary
 java.lang.String getCharset()
          Returns the character enconding of the source.
 java.lang.String getContent()
          Returns the content of the script element.
 java.lang.String getSrc()
          Returns the URI of the source that contains the script codes.
 java.lang.String getType()
          Deprecated. As of release 5.0.0, it is meaningless since text/javascript is always assumed.
 boolean isDefer()
          Returns whether to defer the execution of the script codes until the widget is instantiated and mounted.
 void setCharset(java.lang.String charset)
          Sets the character encoding of the source.
 void setContent(java.lang.String content)
          Sets the content of the script element.
 void setDefer(boolean defer)
          Sets whether to defer the execution of the script codes.
 void setSrc(java.lang.String src)
          Sets the URI of the source that contains the script codes.
 void setType(java.lang.String type)
          Deprecated. As of release 5.0.0, it is meaningless since text/javascript is always assumed.
 

Method Detail

getType

java.lang.String getType()
Deprecated. As of release 5.0.0, it is meaningless since text/javascript is always assumed.


setType

void setType(java.lang.String type)
Deprecated. As of release 5.0.0, it is meaningless since text/javascript is always assumed.


getCharset

java.lang.String getCharset()
Returns the character enconding of the source. It is used with getSrc().

Default: null.


setCharset

void setCharset(java.lang.String charset)
Sets the character encoding of the source. It is used with setSrc(java.lang.String).


getSrc

java.lang.String getSrc()
Returns the URI of the source that contains the script codes.

Default: null.


setSrc

void setSrc(java.lang.String src)
Sets the URI of the source that contains the script codes.

You either add the script codes directly with the Label children, or set the URI to load the script codes with setSrc(java.lang.String). But, not both.

Parameters:
src - the URI of the source that contains the script codes

isDefer

boolean isDefer()
Returns whether to defer the execution of the script codes until the widget is instantiated and mounted.

Default: false.

Specifying false (default), if you want to do the desktop-level (or class-level) initialization, such as defining a widget class or a global function.

Specifying true, if you want to access widgets. Notice that this references to this script widget.


setDefer

void setDefer(boolean defer)
Sets whether to defer the execution of the script codes.

See Also:
isDefer()

getContent

java.lang.String getContent()
Returns the content of the script element. By content we mean the JavaScript codes that will be enclosed by the HTML SCRIPT element.

Default: null.


setContent

void setContent(java.lang.String content)
Sets the content of the script element. By content we mean the JavaScript codes that will be enclosed by the HTML SCRIPT element.



Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo