public class ZScriptInfo
extends java.lang.Object
Constructor and Description |
---|
ZScriptInfo(NodeInfo parent,
java.lang.String zslang,
java.lang.String content,
ConditionImpl cond)
Creates a
ZScriptInfo with the content directly. |
ZScriptInfo(NodeInfo parent,
java.lang.String zslang,
java.lang.String url,
Locator locator,
ConditionImpl cond)
Constructs a
ZScriptInfo with an URL, which might contain an EL
expression. |
ZScriptInfo(NodeInfo parent,
java.lang.String zslang,
java.net.URL url,
ConditionImpl cond)
Create a
ZScriptInfo with an URL that is used to load the content. |
Modifier and Type | Method and Description |
---|---|
void |
appendChild(NodeInfo child)
Append a child
|
java.util.List<NodeInfo> |
getChildren()
Returns a readonly list of children.
|
java.lang.String |
getContent(Page page,
Component comp)
Returns the content of zscript.
|
Evaluator |
getEvaluator()
Returns the evaluator.
|
EvaluatorRef |
getEvaluatorRef()
Returns the evaluator reference.
|
java.lang.String |
getLanguage()
Returns the scripting language, or null if the default scripting language
is preferred.
|
PageDefinition |
getPageDefinition()
Returns the page definition, i.e., the root node, or null if not available.
|
NodeInfo |
getParent()
Returns the parent, or null if it has no parent.
|
java.lang.String |
getRawContent()
Returns the raw content.
|
ZScript |
getZScript()
Returns the
ZScript object hold in this info. |
boolean |
isDeferred()
Returns whether the evaluation of the zscript shall be deferred.
|
boolean |
isEffective(Component comp)
Used to evaluate whether it is effective.
|
boolean |
isEffective(Page page)
Used to evaluate whether it is effective.
|
boolean |
removeChild(NodeInfo child)
Removes a child.
|
void |
setCondition(ConditionImpl cond)
Sets the effectiveness condition.
|
void |
setDeferred(boolean deferred)
Sets whether the evaluation of the zscript shall be deferred.
|
void |
setLanguage(java.lang.String zslang)
Sets the scripting language.
|
java.lang.String |
toString() |
boolean |
withCondition()
Tests if the condition is set
|
public ZScriptInfo(NodeInfo parent, java.lang.String zslang, java.lang.String content, ConditionImpl cond)
ZScriptInfo
with the content directly.zslang
- the scripting language. If null, it is the same as
Page.getZScriptLanguage()
.content
- the zscript contentpublic ZScriptInfo(NodeInfo parent, java.lang.String zslang, java.net.URL url, ConditionImpl cond)
ZScriptInfo
with an URL that is used to load the content.url
- the URL to load the content of zscript.public ZScriptInfo(NodeInfo parent, java.lang.String zslang, java.lang.String url, Locator locator, ConditionImpl cond)
ZScriptInfo
with an URL, which might contain an EL
expression.url
- the URL. It may contain XEL expressions.locator
- the locator used to locate the zscript filepublic java.lang.String getLanguage()
public void setLanguage(java.lang.String zslang)
zslang
- the scripting language. If null, the default scripting
language is assume.public java.lang.String getRawContent()
ZScriptInfo(NodeInfo, String, String, ConditionImpl)
.
If URL is specified in the constructor, null is returned.
On the other hand, getContent(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Component)
will load the content
automatically if URL is specified.
public java.lang.String getContent(Page page, Component comp)
Note: before evaluating the returned script, you have to invoke
isEffective(Component)
or isEffective(Page)
first.
page
- the page when this zscript is interpreted.
Used only if this object is constructed with ZScriptInfo(NodeInfo, String, String, Locator, ConditionImpl)
.comp
- the component when this zscript is interpreted.
Used only if this object is constructed with ZScriptInfo(NodeInfo, String, String, Locator, ConditionImpl)
.UiException
- if failed to load the contentpublic boolean isDeferred()
public void setDeferred(boolean deferred)
Default: false.
public java.lang.String toString()
toString
in class java.lang.Object
public void setCondition(ConditionImpl cond)
public boolean withCondition()
public boolean isEffective(Component comp)
Condition
isEffective
in interface Condition
comp
- used as the self variable. Ignored if null.public boolean isEffective(Page page)
Condition
isEffective
in interface Condition
page
- used as the self variable. Ignored if null.public EvaluatorRef getEvaluatorRef()
NodeInfo
getEvaluatorRef
in interface NodeInfo
public PageDefinition getPageDefinition()
NodeInfo
getPageDefinition
in interface NodeInfo
public Evaluator getEvaluator()
NodeInfo
All nodes in the same ZUML tree has the same evaluator reference
(inherited from the root node, PageDefinition.getEvaluatorRef()
).
getEvaluator
in interface NodeInfo
public NodeInfo getParent()
NodeInfo
public java.util.List<NodeInfo> getChildren()
NodeInfo
Note: the returned list is readonly. To modify, please use
NodeInfo.appendChild(org.zkoss.zk.ui.metainfo.NodeInfo)
and NodeInfo.removeChild(org.zkoss.zk.ui.metainfo.NodeInfo)
instead.
getChildren
in interface NodeInfo
public void appendChild(NodeInfo child)
NodeInfo
appendChild
in interface NodeInfo
public boolean removeChild(NodeInfo child)
NodeInfo
removeChild
in interface NodeInfo
Copyright © 2005-2023 Potix Corporation. All Rights Reserved.