custom-attributes"

From Documentation
m
m (correct highlight (via JWB))
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{ZKZUMLReferencePageHeader}}
+
{{ZUMLReferencePageHeader}}
 
 
 
__TOC__
 
__TOC__
  
<source lang="xml" >
+
'''Syntax:'''
 
  <custom-attributes
 
  <custom-attributes
     [scope="'''component'''|space|page|desktop|session|application]
+
    ''attr1''="''value1''" [''attr2''="''value2''"...]
     ''attr1''="''value1''" [''attr2''="''value2''"...]/>
+
     [scope="'''component'''|space|page|desktop|session|application"]  
</source>
+
     [composite="'''none'''|list|map"]
 +
    [if="''if-condition''"]
 +
    [unless="''unless-condition''"]/>
  
It defines a set of custom attributes of the specified scope. You could specify as many as attributes you want. These attributes can be retrieved by the <tt>getAttribute</tt> method of the <tt>Component</tt> interface with the specified scope.
+
It defines a set of custom attributes of the specified scope. You could specify as many as attributes you want. These attributes can be retrieved by the <code>getAttribute</code> method of the <code>Component</code> interface with the specified scope.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 17: Line 18:
 
== scope ==
 
== scope ==
  
<source lang="xml" >
+
[optional][Default: <code>component</code> or <code>page</code> depending on this parent]
[optional][Default: component]
+
 
 +
Specifies the scope to which the custom attributes are associated. If not specified and enclosed with a component, the component is the default scope. If not specified and not enclosed with a component, the default scope is <code>page</code> (since 5.0.8). For example,
 +
 
 +
<source lang="xml">
 +
<zk>
 +
<custom-attributes a="A"/><!-- assign to page's attribute (since 5.0.8) -->
 +
<button label="show a" onClick='alert(page.getAttribute("a"))'/>
 +
<button label="show b" onClick='alert(self.getAttribute("b"))'>
 +
<custom-attributes b="B"/> <!-- assign to the button's attribute -->
 +
</button>
 +
</zk>
 
</source>
 
</source>
 
Specifies the scope to which the custom attributes are associated. If not specified, the component enclosing this element is the default scope to use.
 
  
 
== composite ==
 
== composite ==
  
<source lang="xml" >
+
[Optional][Default: none]
[Optional][Default: none]
 
</source>
 
  
Specifies the format of the value. It could be <tt>none</tt>, <tt>list</tt> or <tt>map</tt>.
+
Specifies the format of the value. It could be <code>none</code>, <code>list</code> or <code>map</code>.
  
 
By default, the value is assigned to the attribute directly after evaluating EL expressions, if any. For example, "apple, ${more}" is evaluated to "apple, orange", if more is "orange", and assigned to the attribute.
 
By default, the value is assigned to the attribute directly after evaluating EL expressions, if any. For example, "apple, ${more}" is evaluated to "apple, orange", if more is "orange", and assigned to the attribute.
  
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 48:
 
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 51: Line 58:
 
== if ==
 
== if ==
  
<source lang="xml" >
+
[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.
Line 59: Line 64:
 
== unless ==
 
== unless ==
  
<source lang="xml" >
+
[Optional][Default: false]
[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.
Line 67: Line 70:
 
==Version History==
 
==Version History==
  
{{ZKZUMLReferencePageFooter}}
+
{| border='1px' | width="100%"
 +
! Version !! Date !! Content
 +
|-
 +
| 5.0.8
 +
| July, 2011
 +
| The custom-attributes element is allowed to be placed under the page definition directly.
 +
|}
 +
 
 +
{{ZUMLReferencePageFooter}}

Latest revision as of 13:27, 19 January 2022


custom-attributes


Syntax:

<custom-attributes
    attr1="value1" [attr2="value2"...] 
    [scope="component|space|page|desktop|session|application"] 
    [composite="none|list|map"]
    [if="if-condition"] 
    [unless="unless-condition"]/>

It defines a set of custom attributes of the specified scope. You could specify as many as attributes you want. These attributes can be retrieved by the getAttribute method of the Component interface with the specified scope.

 <custom-attributes cd="${param.cd}" a.b="ab"/>

scope

[optional][Default: component or page depending on this parent]

Specifies the scope to which the custom attributes are associated. If not specified and enclosed with a component, the component is the default scope. If not specified and not enclosed with a component, the default scope is page (since 5.0.8). For example,

<zk>
	<custom-attributes a="A"/><!-- assign to page's attribute (since 5.0.8) -->
	<button label="show a" onClick='alert(page.getAttribute("a"))'/>
	<button label="show b" onClick='alert(self.getAttribute("b"))'>
		<custom-attributes b="B"/> <!-- assign to the button's attribute -->
	</button>
</zk>

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 attribute directly after evaluating EL expressions, if any. For example, "apple, ${more}" is evaluated to "apple, orange", if more is "orange", and assigned to the attribute.

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

 <custom-attributes 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.

 <custom-attributes 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
5.0.8 July, 2011 The custom-attributes element is allowed to be placed under the page definition directly.



Last Update : 2022/01/19

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