Texts"

From Documentation
(Created page with '{{ZUMLReferencePageHeader}} Depending on component's implementation, the text nested in a XML element could be interpreted as the value of a component's particular property. For…')
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{ZUMLReferencePageHeader}}
 
{{ZUMLReferencePageHeader}}
  
Depending on component's implementation, the text nested in a XML element could be interpreted as the value of a component's particular property. For example, <javadoc>org.zkoss.zul.Html</javadoc> is one of this kind of components, and
+
In general, a XML text is interpreted as a label component. For example,
 +
 
 +
<source lang="xml">
 +
<window>
 +
  Begin ${foo.whatever}
 +
</window>
 +
</source>
 +
 
 +
is equivalent to
 +
 
 +
<source lang="xml">
 +
<window>
 +
  <label value="Begin ${foo.whatever}"/>
 +
</window>
 +
</source>
 +
 
 +
=Components consider the nested content as proerty=
 +
 
 +
However, a component can be designed to accept the nested text as the value of a component property. In other words, a component designer could decide to make ZK Loader interpret the nest text as the value of a predefined property. For example, <javadoc>org.zkoss.zul.Html</javadoc> is one of this kind of components, and
  
 
<source lang="xml">
 
<source lang="xml">
Line 13: Line 31:
 
</source>
 
</source>
  
It is designed to make it easy to specify multiple-line value, so it is usually used by particular components that requires the multi-line value. Here is a list of components that interprets the XML text as a property's value.
+
It is designed to make it easy to specify multiple-line value, so it is usually used by particular components that requires the multi-line value.
 +
 
 +
Here is a list of components that interprets the XML text as a property's value.
  
 
{| border='1px'
 
{| border='1px'
Line 45: Line 65:
 
| content
 
| content
 
| <javadoc method="setContent(java.lang.String)">org.zkoss.zul.Style</javadoc>
 
| <javadoc method="setContent(java.lang.String)">org.zkoss.zul.Style</javadoc>
 +
|-
 +
| tab
 +
| label
 +
| <javadoc method="setLabel(java.lang.String)">org.zkoss.zul.Tab</javadoc> (since 5.0.7)
 +
 +
'''Note:''' Since 6.5.0, please use <javadoc method="setLabel(java.lang.String)">org.zkoss.zul.Tab</javadoc> instead
 
|}
 
|}
 +
 +
==The nested XML content==
 +
[since 6.0.0]
 +
 +
Since ZK 6, components that consider the text as a property's value will accept the XML fragment. For example,
 +
 +
<source lang="xml">
 +
<html>
 +
  <ol style="border: 1px solid blue">
 +
    <li>Apple</li>
 +
    <li>Orange</li>
 +
  </ol>
 +
</html>
 +
</source>
 +
 +
In other words, you don't have to escape the special characters (&lt; and &gt;) with <code>CDATA</code>. In addition, you could leverage the full power of  ZUML such as [[ZUML Reference/ZUML/Elements/zk|the zk element]] and [[ZUML Reference/ZUML/Attributes/forEach|the forEach attribute]]. For example,
 +
 +
<source lang="xml">
 +
<html>
 +
  <ol>
 +
    <li forEach="Apple, Orange">${each}</li>
 +
  </ol>
 +
</html>
 +
</source>
 +
 +
Note that the nested content is part of the ZUML page, so it must be a legal XML document.
  
 
=Version History=
 
=Version History=
Last Update : {{REVISIONYEAR}}/{{REVISIONMONTH}}/{{REVISIONDAY}}
+
{{LastUpdated}}
 
{| border='1px' | width="100%"
 
{| border='1px' | width="100%"
 
! Version !! Date !! Content
 
! Version !! Date !! Content
 
|-
 
|-
| &nbsp;
+
| 5.0.7
| &nbsp;
+
| April 2011
| &nbsp;
+
| <javadoc>org.zkoss.zul.Tab</javadoc> allow the XML text as the label.
 +
|-
 +
| 6.0.0
 +
| September 2011
 +
| The nested XML content was supported.
 +
|-
 +
| 6.5.0
 +
| September 2012
 +
| [http://tracker.zkoss.org/browse/ZK-970 The Tab component support caption component as it's label]
 
|}
 
|}
  
 
{{ZUMLReferencePageFooter}}
 
{{ZUMLReferencePageFooter}}

Latest revision as of 03:43, 21 August 2012

In general, a XML text is interpreted as a label component. For example,

<window>
  Begin ${foo.whatever}
</window>

is equivalent to

<window>
  <label value="Begin ${foo.whatever}"/>
</window>

Components consider the nested content as proerty

However, a component can be designed to accept the nested text as the value of a component property. In other words, a component designer could decide to make ZK Loader interpret the nest text as the value of a predefined property. For example, Html is one of this kind of components, and

<html>Begin ${foo.whatever}</html>

is equivalent to

<html content="Begin ${foo.whatever}"/>

It is designed to make it easy to specify multiple-line value, so it is usually used by particular components that requires the multi-line value.

Here is a list of components that interprets the XML text as a property's value.

Component Name Property Name Method
a label A.setLabel(String)
button label Button.setLabel(String)
comboitem content Comboitem.setContent(String)
html content Html.setContent(String)
label value Label.setValue(String)
script content Script.setContent(String)
style content Style.setContent(String)
tab label Tab.setLabel(String) (since 5.0.7)

Note: Since 6.5.0, please use Tab.setLabel(String) instead

The nested XML content

[since 6.0.0]

Since ZK 6, components that consider the text as a property's value will accept the XML fragment. For example,

<html>
  <ol style="border: 1px solid blue">
    <li>Apple</li>
    <li>Orange</li>
  </ol>
</html>

In other words, you don't have to escape the special characters (< and >) with CDATA. In addition, you could leverage the full power of ZUML such as the zk element and the forEach attribute. For example,

<html>
  <ol>
    <li forEach="Apple, Orange">${each}</li>
  </ol>
</html>

Note that the nested content is part of the ZUML page, so it must be a legal XML document.

Version History

Last Update : 2012/08/21


Version Date Content
5.0.7 April 2011 Tab allow the XML text as the label.
6.0.0 September 2011 The nested XML content was supported.
6.5.0 September 2012 The Tab component support caption component as it's label



Last Update : 2012/08/21

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