variables"

From Documentation
m
m (correct highlight (via JWB))
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
{{ZUMLReferencePageHeader}}
 
{{ZUMLReferencePageHeader}}
 +
 +
{{Deprecated
 +
|url=[[ZUML Reference/ZUML/Elements/custom-attributes]]
 +
|}}
  
 
__TOC__
 
__TOC__
  
<source lang="xml" >
+
'''Syntax:'''
  <variables [local="'''false'''|true] ''var1''="''value1''" [''var2''="''value2''"...]/>
+
  <variables [local="'''false'''|true]
</source>
+
''var1''="''value1''" [''var2''="''value2''"...] [if="''if-condition''"] [unless="''unless-condition''"]/>
  
It defines a set of variables for the ID space it belongs. It is equivalent to the <tt>setVariable</tt> method of <tt>Component</tt>, if it has a parent component, and <tt>Page</tt>, if it is declared at the page level.
+
It defines a set of variables for the ID space it belongs. It is equivalent to the <code>setVariable</code> method of <code>Component</code>, if it has a parent component, and <code>Page</code>, if it is declared at the page level.
  
 
You could specify as many as variables you want. These variables are stored to the namespace of the ID space it belongs. Thus, they can be accessible by the interpreters and EL expressions.
 
You could specify as many as variables you want. These variables are stored to the namespace of the ID space it belongs. Thus, they can be accessible by the interpreters and EL expressions.
Line 16: Line 20:
  
 
== local ==
 
== local ==
 
+
[Optional][Default: false]
<source lang="xml" >
 
[optional][Default: false]
 
</source>
 
  
 
Specifies whether to store the variable always at the current ID space. By default, it is false. It means ZK will check the existence of any variable with the same name by looking up the current ID space, the parent ID space, and parent's parent, and so on. If found, the variable's value is replaced with the value specified here. If not, a local variable is created. If true is specified, it doesn't look up any parent ID space.
 
Specifies whether to store the variable always at the current ID space. By default, it is false. It means ZK will check the existence of any variable with the same name by looking up the current ID space, the parent ID space, and parent's parent, and so on. If found, the variable's value is replaced with the value specified here. If not, a local variable is created. If true is specified, it doesn't look up any parent ID space.
  
 
== composite ==
 
== composite ==
 +
[Optional][Default: none]
  
<source lang="xml" >
+
Specifies the format of the value. It could be <code>none</code>, <code>list</code> or <code>map</code>.
[Optional][Default: none]
 
</source>
 
 
 
Specifies the format of the value. It could be <tt>none</tt>, <tt>list</tt> or <tt>map</tt>.
 
  
 
By default, the value is assigned to the variable directly after evaluating EL expressions, if any. For example, "apple, ${more}" is evaluated to "apple, orange", if more is "orange", and assigned to the variable.
 
By default, the value is assigned to the variable directly after evaluating EL expressions, if any. For example, "apple, ${more}" is evaluated to "apple, orange", if more is "orange", and assigned to the variable.
  
If you want to specify a list of values, you can specify the <tt>composite</tt> attribute with <tt>list</tt> as follows.
+
If you want to specify a list of values, you can specify the <code>composite</code> attribute with <code>list</code> as follows.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 41: Line 39:
 
Then, it is converted to a list with two elements. The first element is "apple" and the second "orange".
 
Then, it is converted to a list with two elements. The first element is "apple" and the second "orange".
  
If you want to specify a map of values, you can specify the <tt>composite</tt> attribute with <tt>map</tt> as follows.
+
If you want to specify a map of values, you can specify the <code>composite</code> attribute with <code>map</code> as follows.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 50: Line 48:
  
 
== if ==
 
== if ==
 
+
[Optional][Default: true]
<source lang="xml" >
 
[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="xml" >
 
[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.

Latest revision as of 13:27, 19 January 2022

Stop.png This article is out of date, please refer to ZUML Reference/ZUML/Elements/custom-attributes for more up to date information.

Syntax:

<variables [local="false|true]
var1="value1" [var2="value2"...] [if="if-condition"] [unless="unless-condition"]/>

It defines a set of variables for the ID space it belongs. It is equivalent to the setVariable method of Component, if it has a parent component, and Page, if it is declared at the page level.

You could specify as many as variables you want. These variables are stored to the namespace of the ID space it belongs. Thus, they can be accessible by the interpreters and EL expressions.

 <variables cd="${param.cd}" less="more"/>

local

[Optional][Default: false]

Specifies whether to store the variable always at the current ID space. By default, it is false. It means ZK will check the existence of any variable with the same name by looking up the current ID space, the parent ID space, and parent's parent, and so on. If found, the variable's value is replaced with the value specified here. If not, a local variable is created. If true is specified, it doesn't look up any parent ID space.

composite

[Optional][Default: none]

Specifies the format of the value. It could be none, list or map.

By default, the value is assigned to the variable directly after evaluating EL expressions, if any. For example, "apple, ${more}" is evaluated to "apple, orange", if more is "orange", and assigned to the variable.

If you want to specify a list of values, you can specify the composite attribute with list as follows.

 <variables simple="apple, ${more}" composite="list"/>

Then, it is converted to a list with two elements. The first element is "apple" and the second "orange".

If you want to specify a map of values, you can specify the composite attribute with map as follows.

 <variables simple="juice=apple, flavor=${more}" composite="map"/>

Then, it is converted to a map with two entries. The first entry is ("juice", "apple") and the second ("flavor", "orange").

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.

Version History

Version Date Content
     



Last Update : 2022/01/19

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