| java.lang.Object org.zkoss.zk.ui.AbstractComponent org.zkoss.zul.Script
Script | public class Script extends AbstractComponent (Code) | | 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.
To avoid typo, this compnent requires you to specify the type
(
Script.setType ) -- which is, if JavaScript, "text/javascript".
There are three formats when used in a ZUML page:
Method 1: Specify the URL of the JS file
<script type="text/javascript" src="my.js"/>
Method 2: Specify the JavaScript codes directly
<script type="text/javascript">
some_js_at_browser();
</script>
Method 3: Specify the JavaScript codes by use of the content
property (
Script.setContent ).
<script type="text/javascript">
<attribute name="content">
some_js_at_browser();
</attribute>
</script>
author: tomyeh |
Constructor Summary | |
public | Script() |
Method Summary | |
public String | getCharset() Returns the character enconding of the source. | public String | getContent() Returns the content of the script element. | public String | getSrc() Returns the URI of the source that contains the script codes. | public String | getType() Returns the type of this client script.
Default: null. | public boolean | isChildable() Not childable. | public boolean | isDefer() Returns whether to defer the execution of the script codes. | public void | redraw(java.io.Writer out) | public void | setCharset(String charset) Sets the character encoding of the source. | public void | setContent(String content) Sets the content of the script element. | public void | setDefer(boolean defer) Sets whether to defer the execution of the script codes. | public void | setSrc(String src) Sets the URI of the source that contains the script codes. | public void | setType(String type) Sets the type of this client script.
For JavaScript, it is text/javascript
Note: this property is NOT optional. |
getCharset | public String getCharset()(Code) | | Returns the character enconding of the source.
It is used with
Script.getSrc .
Default: null.
|
getContent | public String getContent()(Code) | | 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.
since: 3.0.0 |
getSrc | public String getSrc()(Code) | | Returns the URI of the source that contains the script codes.
Default: null.
|
getType | public String getType()(Code) | | Returns the type of this client script.
Default: null. However, it is invalid.
In other words, you must specify a correct type.
For JavaScript, it is "text/javascript".
|
isChildable | public boolean isChildable()(Code) | | Not childable.
|
isDefer | public boolean isDefer()(Code) | | Returns whether to defer the execution of the script codes.
Default: false.
|
setCharset | public void setCharset(String charset)(Code) | | Sets the character encoding of the source.
It is used with
Script.setSrc .
|
setContent | public void setContent(String content)(Code) | | Sets the content of the script element.
By content we mean the JavaScript codes that will be enclosed
by the HTML SCRIPT element.
since: 3.0.0 |
setDefer | public void setDefer(boolean defer)(Code) | | Sets whether to defer the execution of the script codes.
|
setSrc | public void setSrc(String src)(Code) | | 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
Script.setSrc .
But, not both.
Parameters: src - the URI of the source that contains the script codes |
setType | public void setType(String type)(Code) | | Sets the type of this client script.
For JavaScript, it is text/javascript
Note: this property is NOT optional. You must specify one.
|
Methods inherited from org.zkoss.zk.ui.AbstractComponent | public void addAnnotation(String annotName, Map annotAttrs)(Code)(Java Doc) public void addAnnotation(String propName, String annotName, Map annotAttrs)(Code)(Java Doc) public void addEventHandler(String name, EventHandler evthd)(Code)(Java Doc) public boolean addEventListener(String evtnm, EventListener listener)(Code)(Java Doc) public boolean addForward(String orgEvent, Component target, String targetEvent)(Code)(Java Doc) public boolean addForward(String orgEvent, String targetPath, String targetEvent)(Code)(Java Doc) protected void addMoved(Component oldparent, Page oldpg, Page newpg)(Code)(Java Doc) public void addSharedAnnotationMap(AnnotationMap annots)(Code)(Java Doc) public void addSharedEventHandlerMap(EventHandlerMap evthds)(Code)(Java Doc) protected StringBuffer appendAsapAttr(StringBuffer sb, String evtnm)(Code)(Java Doc) final public boolean appendChild(Component child)(Code)(Java Doc) public void applyProperties()(Code)(Java Doc) public Object clone()(Code)(Java Doc) public boolean containsVariable(String name, boolean local)(Code)(Java Doc) public void detach()(Code)(Java Doc) final public boolean equals(Object o)(Code)(Java Doc) public List getAnnotatedProperties()(Code)(Java Doc) public List getAnnotatedPropertiesBy(String annotName)(Code)(Java Doc) public Annotation getAnnotation(String annotName)(Code)(Java Doc) public Annotation getAnnotation(String propName, String annotName)(Code)(Java Doc) public Collection getAnnotations()(Code)(Java Doc) public Collection getAnnotations(String propName)(Code)(Java Doc) public Object getAttribute(String name, int scope)(Code)(Java Doc) final public Object getAttribute(String name)(Code)(Java Doc) public Map getAttributes(int scope)(Code)(Java Doc) final public Map getAttributes()(Code)(Java Doc) public List getChildren()(Code)(Java Doc) public ComponentDefinition getDefinition()(Code)(Java Doc) final public Desktop getDesktop()(Code)(Java Doc) public ZScript getEventHandler(String evtnm)(Code)(Java Doc) public Set getEventHandlerNames()(Code)(Java Doc) public Object getExtraCtrl()(Code)(Java Doc) public Component getFellow(String compId)(Code)(Java Doc) public Component getFellowIfAny(String compId)(Code)(Java Doc) public Component getFirstChild()(Code)(Java Doc) public String getId()(Code)(Java Doc) public Component getLastChild()(Code)(Java Doc) public Iterator getListenerIterator(String evtnm)(Code)(Java Doc) final public String getMold()(Code)(Java Doc) protected Object getMoldURI()(Code)(Java Doc) public Namespace getNamespace()(Code)(Java Doc) public Component getNextSibling()(Code)(Java Doc) final public Page getPage()(Code)(Java Doc) public Component getParent()(Code)(Java Doc) public Component getPreviousSibling()(Code)(Java Doc) public Component getPropagatee(String evtnm)(Code)(Java Doc) public Component getRoot()(Code)(Java Doc) final public IdSpace getSpaceOwner()(Code)(Java Doc) final public String getUuid()(Code)(Java Doc) public Object getVariable(String name, boolean local)(Code)(Java Doc) public boolean insertBefore(Component newChild, Component refChild)(Code)(Java Doc) public void invalidate()(Code)(Java Doc) protected boolean isAsapRequired(String evtnm)(Code)(Java Doc) public boolean isChildable()(Code)(Java Doc) public boolean isListenerAvailable(String evtnm, boolean asap)(Code)(Java Doc) public boolean isVisible()(Code)(Java Doc) protected Object newExtraCtrl()(Code)(Java Doc) public void onChildAdded(Component child)(Code)(Java Doc) public void onChildRemoved(Component child)(Code)(Java Doc) public void onDrawNewChild(Component child, StringBuffer out) throws IOException(Code)(Java Doc) public void onPageAttached(Page newpage, Page oldpage)(Code)(Java Doc) public void onPageDetached(Page page)(Code)(Java Doc) public WrongValueException onWrongValue(WrongValueException ex)(Code)(Java Doc) public void redraw(Writer out) throws IOException(Code)(Java Doc) public Object removeAttribute(String name, int scope)(Code)(Java Doc) final public Object removeAttribute(String name)(Code)(Java Doc) public boolean removeChild(Component child)(Code)(Java Doc) public boolean removeEventListener(String evtnm, EventListener listener)(Code)(Java Doc) public boolean removeForward(String orgEvent, Component target, String targetEvent)(Code)(Java Doc) public boolean removeForward(String orgEvent, String targetPath, String targetEvent)(Code)(Java Doc) public void response(String key, AuResponse response)(Code)(Java Doc) public void sessionDidActivate(Page page)(Code)(Java Doc) public void sessionWillPassivate(Page page)(Code)(Java Doc) public Object setAttribute(String name, Object value, int scope)(Code)(Java Doc) final public Object setAttribute(String name, Object value)(Code)(Java Doc) public void setComponentDefinition(ComponentDefinition compdef)(Code)(Java Doc) public void setId(String id)(Code)(Java Doc) public void setMold(String mold)(Code)(Java Doc) public void setPage(Page page)(Code)(Java Doc) public void setPageBefore(Page page, Component refRoot)(Code)(Java Doc) public void setParent(Component parent)(Code)(Java Doc) public void setVariable(String name, Object val, boolean local)(Code)(Java Doc) public boolean setVisible(boolean visible)(Code)(Java Doc) public void smartUpdate(String attr, String value)(Code)(Java Doc) public void smartUpdate(String attr, int value)(Code)(Java Doc) public void smartUpdate(String attr, boolean value)(Code)(Java Doc) public void smartUpdateDeferred(String attr, DeferredValue value)(Code)(Java Doc) public String toString()(Code)(Java Doc) public void unsetVariable(String name, boolean local)(Code)(Java Doc)
|
|
|