Package org.zkoss.zk.ui.metainfo
Class ZkInfo
- java.lang.Object
-
- org.zkoss.zk.ui.metainfo.ZkInfo
-
public class ZkInfo extends java.lang.Object
Represents the zk element in a ZUML page.- Since:
- 3.5.0
- Author:
- tomyeh
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ZkInfo(NodeInfo parent, ConditionImpl cond)
Constructs a ZK info.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendChild(NodeInfo child)
Append a childjava.util.List<NodeInfo>
getChildren()
Returns a readonly list of children.ConditionImpl
getCondition()
Returns the effectiveness condition.Evaluator
getEvaluator()
Returns the evaluator.EvaluatorRef
getEvaluatorRef()
Returns the evaluator reference.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.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.java.lang.Object[]
resolveCase(Page page, Component comp)
Returns the case condition's value, or null if no case is specified (i.e.,withCase()
is false.ForEach
resolveForEach(Page page, Component comp)
Returns the forEach object if the forEach attribute is defined (orsetForEach(java.lang.String, java.lang.String, java.lang.String)
is called).java.lang.Object
resolveSwitch(Page page, Component comp)
Returns the switch condition's value; evaluate EL expression if any.void
setCase(java.lang.String casec)
Sets the case condition.void
setCondition(ConditionImpl cond)
Sets the effectiveness condition.void
setForEach(java.lang.String expr, java.lang.String begin, java.lang.String end)
Sets the forEach attribute, which is usually an expression.void
setForEach(java.lang.String expr, java.lang.String begin, java.lang.String end, java.lang.String step)
Sets the forEach attribute, which is usually an expression.void
setSwitch(java.lang.String switchc)
Sets the switch condition.java.lang.String
toString()
boolean
withCase()
Returns whether the case condition is defined.boolean
withCondition()
Tests if the condition is setboolean
withForEach()
Returns whether the forEach condition is defined.boolean
withSwitch()
Returns whether the switch condition is defined.
-
-
-
Constructor Detail
-
ZkInfo
public ZkInfo(NodeInfo parent, ConditionImpl cond)
Constructs a ZK info.
-
-
Method Detail
-
withSwitch
public boolean withSwitch()
Returns whether the switch condition is defined.
-
setSwitch
public void setSwitch(java.lang.String switchc)
Sets the switch condition.- Parameters:
switchc
- the switch condition; EL allowed. Ignored if null. Note: if it is an empty string, the switch condition (returned byresolveSwitch(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Component)
) is an empty string.
-
resolveSwitch
public java.lang.Object resolveSwitch(Page page, Component comp)
Returns the switch condition's value; evaluate EL expression if any.Note: unlike
resolveCase(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Component)
, it might return null even ifwithSwitch()
is true.
-
withCase
public boolean withCase()
Returns whether the case condition is defined.
-
setCase
public void setCase(java.lang.String casec)
Sets the case condition.
-
resolveCase
public java.lang.Object[] resolveCase(Page page, Component comp)
Returns the case condition's value, or null if no case is specified (i.e.,withCase()
is false. It evaluates EL expression if any.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
resolveForEach
public ForEach resolveForEach(Page page, Component comp)
Returns the forEach object if the forEach attribute is defined (orsetForEach(java.lang.String, java.lang.String, java.lang.String)
is called).If comp is not null, both pagedef and page are ignored. If comp is null, page must be specified.
- Parameters:
page
- the page. It is used only if comp is null.comp
- the component.- Returns:
- the forEach object to iterate this info multiple times, or null if this info shall be interpreted only once.
-
setForEach
public void setForEach(java.lang.String expr, java.lang.String begin, java.lang.String end)
Sets the forEach attribute, which is usually an expression.- Parameters:
expr
- the expression to return a collection of objects, or null/empty to denote no iteration.
-
setForEach
public void setForEach(java.lang.String expr, java.lang.String begin, java.lang.String end, java.lang.String step)
Sets the forEach attribute, which is usually an expression.- Parameters:
expr
- the expression to return a collection of objects, or null/empty to denote no iteration.- Since:
- 8.0.0
-
withForEach
public boolean withForEach()
Returns whether the forEach condition is defined.
-
getCondition
public ConditionImpl getCondition()
Returns the effectiveness condition.
-
setCondition
public void setCondition(ConditionImpl cond)
Sets the effectiveness condition.
-
withCondition
public boolean withCondition()
Tests if the condition is set
-
appendChild
public void appendChild(NodeInfo child)
Description copied from interface:NodeInfo
Append a child- Specified by:
appendChild
in interfaceNodeInfo
-
removeChild
public boolean removeChild(NodeInfo child)
Description copied from interface:NodeInfo
Removes a child.- Specified by:
removeChild
in interfaceNodeInfo
-
getChildren
public java.util.List<NodeInfo> getChildren()
Description copied from interface:NodeInfo
Returns a readonly list of children.Note: the returned list is readonly. To modify, please use
NodeInfo.appendChild(org.zkoss.zk.ui.metainfo.NodeInfo)
andNodeInfo.removeChild(org.zkoss.zk.ui.metainfo.NodeInfo)
instead.- Specified by:
getChildren
in interfaceNodeInfo
-
isEffective
public boolean isEffective(Component comp)
Description copied from interface:Condition
Used to evaluate whether it is effective.- Specified by:
isEffective
in interfaceCondition
- Parameters:
comp
- used as the self variable. Ignored if null.
-
isEffective
public boolean isEffective(Page page)
Description copied from interface:Condition
Used to evaluate whether it is effective.- Specified by:
isEffective
in interfaceCondition
- Parameters:
page
- used as the self variable. Ignored if null.
-
getEvaluatorRef
public EvaluatorRef getEvaluatorRef()
Description copied from interface:NodeInfo
Returns the evaluator reference.- Specified by:
getEvaluatorRef
in interfaceNodeInfo
-
getPageDefinition
public PageDefinition getPageDefinition()
Description copied from interface:NodeInfo
Returns the page definition, i.e., the root node, or null if not available.- Specified by:
getPageDefinition
in interfaceNodeInfo
-
getEvaluator
public Evaluator getEvaluator()
Description copied from interface:NodeInfo
Returns the evaluator.All nodes in the same ZUML tree has the same evaluator reference (inherited from the root node,
PageDefinition.getEvaluatorRef()
).- Specified by:
getEvaluator
in interfaceNodeInfo
-
-