zk"

From Documentation
m
m (correct highlight (via JWB))
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{ZKZUMLReferencePageHeader}}
+
{{ZUMLReferencePageHeader}}
  
 
__TOC__
 
__TOC__
  
<source lang="xml" >
+
'''Syntax:'''
 
  <zk>...</zk>
 
  <zk>...</zk>
</source>
 
  
It is a special element used to aggregate other components. Unlike a real component (say, <tt>hbox</tt> or <tt>div</tt>), it is not part of the component tree being created. In other words, it doesn't represent any component. For example,
+
It is a special element used to aggregate other components. Unlike a real component (say, <code>hbox</code> or <code>div</code>), it is not part of the component tree being created. In other words, it doesn't represent any component. For example,
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 53: Line 52:
  
 
== if ==
 
== if ==
<source lang="bash" >
+
[Optional][Default: true]
[Optional][Default: true]
 
</source>
 
  
 
Specifies the condition to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to false.
 
Specifies the condition to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to false.
  
 
== unless ==
 
== unless ==
 
+
[Optional][Default: false]
<source lang="bash" >
 
[Optional][Default: false]
 
</source>
 
  
 
Specifies the condition ''not'' to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to true.
 
Specifies the condition ''not'' to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to true.
  
 
== forEach ==
 
== forEach ==
<source lang="bash" >
+
[Optional][Default: ''ignored'']
[Optional][Default: ''ignored'']
 
</source>
 
  
It specifies a collection of objects, such that the <tt>zk</tt> element will be evaluated repeatedly against each object in the collection. If not specified or empty, this attribute is ignored. If non-collection object is specified, it is evaluated only once as if a single-element collection is specified.
+
It specifies a collection of objects, such that the <code>zk</code> element will be evaluated repeatedly against each object in the collection. If not specified or empty, this attribute is ignored. If non-collection object is specified, it is evaluated only once as if a single-element collection is specified.
  
 
== forEachBegin ==
 
== forEachBegin ==
 +
[Optional][Default: 0]
  
<source lang="xml" >
+
It is used with the <code>forEach</code> attribute to specify the starting offset when iterating a collection of objects. If not specified, it iterates from the first element, i.e., 0 is assumed.
[Optional][Default: 0]
 
</source>
 
 
 
It is used with the <tt>forEach</tt> attribute to specify the starting offset when iterating a collection of objects. If not specified, it iterates from the first element, i.e., 0 is assumed.
 
  
 
== forEachBegin ==
 
== forEachBegin ==
 +
[Optional][Default: 0]
  
<source lang="xml" >
+
It is used with the <code>forEach</code> attribute to specify the index (starting from 0) that the iteration should begin at. If not specified, the iteration begins at the first element, i.e., 0 is assumed.
[Optional][Default: 0]
 
</source>
 
 
 
It is used with the <tt>forEach</tt> attribute to specify the index (starting from 0) that the iteration shall begin at. If not specified, the iteration begins at the first element, i.e., 0 is assumed.
 
  
If <tt>forEachBegin</tt> is greater than or equals to the number of elements, no iteration is performed.
+
If <code>forEachBegin</code> is greater than or equals to the number of elements, no iteration is performed.
  
 
== forEachEnd ==
 
== forEachEnd ==
 +
[Optional][Default: ''the last element'']
  
<source lang="xml" >
+
It is used with the <code>forEach</code> attribute to specify the index (starting from 0) the iteration should ends at (inclusive). If not specified, the iterations ends at the last element.
[Optional][Default: ''the last element'']
 
</source>
 
 
 
It is used with the <tt>forEach</tt> attribute to specify the index (starting from 0) the iteration shall ends at (inclusive). If not specified, the iterations ends at the last element.
 
  
 
If forEachEnd is greater than or equals to the number of elements, the iteration ends at the last element.
 
If forEachEnd is greater than or equals to the number of elements, the iteration ends at the last element.
  
 
== switch ==
 
== switch ==
<source lang="xml" >
+
[Optional][Default: ''none'']
[Optional][Default: ''none'']
 
</source>
 
  
 
Provide the context for mutually exclusive evaluation. The value specified in this attribute is called the switch condition.
 
Provide the context for mutually exclusive evaluation. The value specified in this attribute is called the switch condition.
  
 
<source lang="xml" >
 
<source lang="xml" >
  <zk swtich="${condition}"/>
+
  <zk switch="${condition}"/>
 
</source>
 
</source>
  
The only allowed children are the <tt>zk</tt> elements.
+
The only allowed children are the <code>zk</code> elements.
 +
 
 +
Fore more examples, please refer to [[ZK Developer's Reference/UI Composing/ZUML/Conditional Evaluation|ZK Developer's Reference: Conditional Evaluation]].
  
 
== case ==
 
== case ==
 
+
[Optional][Default: ''none'']
<source lang="bash" >
 
[Optional][Default: ''none'']
 
</source>
 
  
 
Provides an alternative within the switch evaluation.
 
Provides an alternative within the switch evaluation.
Line 127: Line 107:
 
</source>
 
</source>
  
If the value is a string starting and ending with slash, such as <tt>/a[p]*/</tt>, it is considered as a regular expression, which is used to match the switch condition.
+
If the value is a string starting and ending with slash, such as <code>/a[p]*/</code>, it is considered as a regular expression, which is used to match the switch condition.
 
<source lang="xml" >
 
<source lang="xml" >
 
  <zk case="/a[a-z]*/"/>
 
  <zk case="/a[a-z]*/"/>
Line 136: Line 116:
 
  <zk case="apple, ${special}"/>
 
  <zk case="apple, ${special}"/>
 
</source>
 
</source>
 +
 +
Fore more examples, please refer to [[ZK Developer's Reference/UI Composing/ZUML/Conditional Evaluation|ZK Developer's Reference: Conditional Evaluation]].
  
 
== choose ==
 
== choose ==
 
+
[Optional][Default: ''none'']
<source lang="bash" >
 
[Optional][Default: ''none'']
 
</source>
 
  
 
Provide the context for mutually exclusive evaluation.
 
Provide the context for mutually exclusive evaluation.
Line 149: Line 128:
 
</source>
 
</source>
  
The only allowed children are the <tt>zk</tt> elements.
+
As shown, the value of the <code>choose</code> attribute is always empty, since it is used only to identify the range of mutually exclusive conditional evaluation.
 +
 
 +
The only allowed children are the <code>zk</code> elements.
 +
 
 +
For more examples, please refer to [[ZK Developer's Reference/UI Composing/ZUML/Conditional Evaluation|ZK Developer's Reference: Conditional Evaluation]].
  
 
== when ==
 
== when ==
 
+
[Optional][Default: ''none'']
<source lang="bash" >
 
[Optional][Default: ''none'']
 
</source>
 
  
 
Provides an alternative within the choose evaluation.
 
Provides an alternative within the choose evaluation.
Line 165: Line 145:
 
It is evaluated if the condition matches.
 
It is evaluated if the condition matches.
  
{{ZKZUMLReferencePageFooter}}
+
For more examples, please refer to [[ZK Developer's Reference/UI Composing/ZUML/Conditional Evaluation|ZK Developer's Reference: Conditional Evaluation]].
 +
 
 +
==Version History==
 +
 
 +
{| border='1px' | width="100%"
 +
! Version !! Date !! Content
 +
|-
 +
| &nbsp;
 +
| &nbsp;
 +
| &nbsp;
 +
|}
 +
 
 +
{{ZUMLReferencePageFooter}}

Latest revision as of 13:27, 19 January 2022

Syntax:

<zk>...</zk>

It is a special element used to aggregate other components. Unlike a real component (say, hbox or div), it is not part of the component tree being created. In other words, it doesn't represent any component. For example,

 <window>
     <zk>
         <textbox/>
         <textbox/>
     </zk>
 </window>

is equivalent to

 <window>
     <textbox/>
     <textbox/>
 </window>

The main use is to represent multiple root elements in XML format.

 <?page title="Multiple Root"?>
 <zk>
     <window title="First">
     ...
     </window>
     <window title="Second" if="${param.secondRequired}">
     ...
     </window>
 </zk>

The other use is to iterate over versatile components.

 <window>
     <zk forEach="${mycols}">
         <textbox if="${each.useText}"/>
         <datebox if="${each.useDate}"/>
         <combobox if="${each.useCombo}"/>
     </zk>
 </window>

if

[Optional][Default: true]

Specifies the condition to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to false.

unless

[Optional][Default: false]

Specifies the condition not to evaluate this element. This element is ignored if the value specified to this attribute is evaluated to true.

forEach

[Optional][Default: ignored]

It specifies a collection of objects, such that the zk element will be evaluated repeatedly against each object in the collection. If not specified or empty, this attribute is ignored. If non-collection object is specified, it is evaluated only once as if a single-element collection is specified.

forEachBegin

[Optional][Default: 0]

It is used with the forEach attribute to specify the starting offset when iterating a collection of objects. If not specified, it iterates from the first element, i.e., 0 is assumed.

forEachBegin

[Optional][Default: 0]

It is used with the forEach attribute to specify the index (starting from 0) that the iteration should begin at. If not specified, the iteration begins at the first element, i.e., 0 is assumed.

If forEachBegin is greater than or equals to the number of elements, no iteration is performed.

forEachEnd

[Optional][Default: the last element]

It is used with the forEach attribute to specify the index (starting from 0) the iteration should ends at (inclusive). If not specified, the iterations ends at the last element.

If forEachEnd is greater than or equals to the number of elements, the iteration ends at the last element.

switch

[Optional][Default: none]

Provide the context for mutually exclusive evaluation. The value specified in this attribute is called the switch condition.

 <zk switch="${condition}"/>

The only allowed children are the zk elements.

Fore more examples, please refer to ZK Developer's Reference: Conditional Evaluation.

case

[Optional][Default: none]

Provides an alternative within the switch evaluation.

 <zk case="apple"/>

If the value is a string starting and ending with slash, such as /a[p]*/, it is considered as a regular expression, which is used to match the switch condition.

 <zk case="/a[a-z]*/"/>

You can specify multiple cases by separating them with comma.

 <zk case="apple, ${special}"/>

Fore more examples, please refer to ZK Developer's Reference: Conditional Evaluation.

choose

[Optional][Default: none]

Provide the context for mutually exclusive evaluation.

 <zk choose="">

As shown, the value of the choose attribute is always empty, since it is used only to identify the range of mutually exclusive conditional evaluation.

The only allowed children are the zk elements.

For more examples, please refer to ZK Developer's Reference: Conditional Evaluation.

when

[Optional][Default: none]

Provides an alternative within the choose evaluation.

 <zk when="${fruit == 'apple'}">

It is evaluated if the condition matches.

For more examples, please refer to ZK Developer's Reference: Conditional Evaluation.

Version History

Version Date Content
     



Last Update : 2022/01/19

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.