attribute"

From Documentation
m
m (correct highlight (via JWB))
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{ZKZUMLReferencePageHeader}}
+
{{ZUMLReferencePageHeader}}
  
 
__TOC__
 
__TOC__
  
<source lang="xml" >
+
'''Syntax:'''
  <attribute name="''myName''" [trim="true|'''false'''"]>''myValue''</attribute>
+
  <attribute name="''myName''" [trim="true|'''false'''"] [if="''if-condition''"] [unless="''unless-condition''"]>''myValue''</attribute>
</source>
 
  
It defines a XML attribute of the enclosing element. The content of the element is the attribute value, while the <tt>name</tt> attribute specifies the attribute name. It is useful if the value of an attribute is sophisticated, or the attribute is conditional.
+
It defines a XML attribute of the enclosing element. The content of the element is the attribute value, while the <code>name</code> attribute specifies the attribute name. It is useful if the value of an attribute is sophisticated, or the attribute is conditional.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 35: Line 34:
 
     <attribute name="content">
 
     <attribute name="content">
 
         <ol>
 
         <ol>
             <li forEach="${values}">${each}</li>
+
             <li forEach="apple, orange">${each}</li>
 
         </ol>
 
         </ol>
 
     </attribute>
 
     </attribute>
Line 41: Line 40:
 
</source>
 
</source>
  
where <tt>ol</tt> and <tt>li</tt> are part of the native content. They are not ZK components. They will be eventually converted to a String instance and assigned to the specified attribute. If values has three elements, the above example is equivalent to the following:
+
where <code>ol</code> and <code>li</code> are part of the native content. They are not ZK components. They will be eventually converted to a String instance and assigned to the specified attribute. If values has three elements, the above example is equivalent to the following:
  
 
<source lang="xml" >
 
<source lang="xml" >
 
+
<html>
  </source>
+
    <attribute name="content">
 +
        <ol>
 +
            <li>apple, orange</li>
 +
            <li>orange</li>
 +
        </ol>
 +
    </attribute>
 +
  </html>
 +
</source>
  
 
== name ==
 
== name ==
<source lang="xml" >
+
[Required]
[Required]
 
</source>
 
  
 
Specifies the attribute name.
 
Specifies the attribute name.
  
 
== trim ==
 
== trim ==
<source lang="xml" >
+
[Optional][Default: false]
[Optional][Default: false]
 
</source>
 
  
 
Specifies whether to omit the leading and trailing whitespaces of the attribute value.
 
Specifies whether to omit the leading and trailing whitespaces of the attribute value.
  
 
== 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 ==
<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.
  
{{ZKZUMLReferencePageFooter}}
+
==Version History==
 +
 
 +
{| border='1px' | width="100%"
 +
! Version !! Date !! Content
 +
|-
 +
| &nbsp;
 +
| &nbsp;
 +
| &nbsp;
 +
|}
 +
 
 +
{{ZUMLReferencePageFooter}}

Latest revision as of 13:27, 19 January 2022

Syntax:

<attribute name="myName" [trim="true|false"] [if="if-condition"] [unless="unless-condition"]>myValue</attribute>

It defines a XML attribute of the enclosing element. The content of the element is the attribute value, while the name attribute specifies the attribute name. It is useful if the value of an attribute is sophisticated, or the attribute is conditional.

 <button label="Hi">
   <attribute name="onClick">alert("Hi")</attribute>
 </button>

It is equivalent to

 <button label="Hi" onClick="alert(&quot;Hi&quot;)"/>

Another example:

 <button>
   <attribute name="label" if="${param.happy}">Hello World!</attribute>
 </button>

In addition, you can specify a XML fragment as the value of the attribute. The XML fragment is so-called the native content.

 <html>
     <attribute name="content">
         <ol>
             <li forEach="apple, orange">${each}</li>
         </ol>
     </attribute>
 </html>

where ol and li are part of the native content. They are not ZK components. They will be eventually converted to a String instance and assigned to the specified attribute. If values has three elements, the above example is equivalent to the following:

 <html>
     <attribute name="content">
         <ol>
             <li>apple, orange</li>
             <li>orange</li>
         </ol>
     </attribute>
 </html>

name

[Required]

Specifies the attribute name.

trim

[Optional][Default: false]

Specifies whether to omit the leading and trailing whitespaces of the attribute value.

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.