apply"

From Documentation
m (correct highlight (via JWB))
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== The apply Attribute ==
+
{{ZUMLReferencePageHeader}}
apply="a-class-name"
 
apply="class1, class2,..."
 
apply="${EL_returns_a_class_or_a_collection_of_classes}"
 
apply="${EL_returns_an_instance_or_a_collection_of_Composer_instances}"
 
  
It specifies a class, a collection of classes that are used to initialize the component. The class must implement the <javadoc type="interface">org.zkoss.zk.util.Composer</javadoc> interface. And then, you can do the initialization in the <tt>doAfterCompose</tt> method, since it is called after the component and all its children are instantiated.
+
'''Syntax'''
 +
apply="''a-class-name''"
 +
apply="''class1'', ''class2'',..."
 +
apply="${''EL_returns_a_class_or_a_collection_of_classes''}"
 +
apply="${''EL_returns_an_instance_or_a_collection_of_Composer_instances''}"
 +
 
 +
It specifies a class, a collection of classes that are used to initialize the component. The class must implement the <javadoc type="interface">org.zkoss.zk.ui.util.Composer</javadoc> interface. And then, you can do the initialization in the <code>doAfterCompose</code> method, since it is called after the component and all its children are instantiated.
  
 
<source lang="xml" >
 
<source lang="xml" >
  <window apply="MyComposer"/>
+
  <window apply="foo.MyComposer"/>
 
</source>
 
</source>
  
In addition, you specify a <tt>Composer</tt> instance, or a collection of <tt>Composer</tt> instances by use of EL expressions.
+
In addition, you specify a <code>Composer</code> instance, or a collection of <code>Composer</code> instances by the use of EL expressions.
 +
 
 +
'''Note:''' the EL expressions are, if specified, evaluated before the component is instantiated. So you cannot reference to the component. Moreover, the <code>self</code> variable references to the parent component, if any, or the current page, if it is the root component, in the EL expressions specified in this attribute.
 +
 
 +
If you want more control such as handling the exception, you can also implement the <javadoc type="interface">org.zkoss.zk.ui.util.ComposerExt</javadoc> interface.
 +
 
 +
If you have a composer that you'd like to apply to every page, you don't need to specify it in every page. Rather, you could register a system-level composer. For more information, please refer to [[ZK Developer's Reference/MVC/Controller/Composer#System-level_Composer|ZK Developer's Reference: System-level Composers]].
 +
 
 +
=Version History=
  
'''Note:''' the EL expressions are, if specified, evaluated before the component is instantiated. So you cannot reference to the component. Moreover, the <tt>self</tt> variable references to the parent component, if any, or the current page, if it is the root component, in the EL expressions specified in this attribute.
+
{| border='1px' | width="100%"
 +
! Version !! Date !! Content
 +
|-
 +
| &nbsp;
 +
| &nbsp;
 +
| &nbsp;
 +
|}
  
If you want more control such as handling the exception, you can also implement the <javadoc type="interface">org.zkoss.zk.util.ComposerExt</javadoc> interface.
+
{{ZUMLReferencePageFooter}}

Latest revision as of 13:26, 19 January 2022

Syntax

apply="a-class-name"
apply="class1, class2,..."
apply="${EL_returns_a_class_or_a_collection_of_classes}"
apply="${EL_returns_an_instance_or_a_collection_of_Composer_instances}"

It specifies a class, a collection of classes that are used to initialize the component. The class must implement the Composer interface. And then, you can do the initialization in the doAfterCompose method, since it is called after the component and all its children are instantiated.

 <window apply="foo.MyComposer"/>

In addition, you specify a Composer instance, or a collection of Composer instances by the use of EL expressions.

Note: the EL expressions are, if specified, evaluated before the component is instantiated. So you cannot reference to the component. Moreover, the self variable references to the parent component, if any, or the current page, if it is the root component, in the EL expressions specified in this attribute.

If you want more control such as handling the exception, you can also implement the ComposerExt interface.

If you have a composer that you'd like to apply to every page, you don't need to specify it in every page. Rather, you could register a system-level composer. For more information, please refer to ZK Developer's Reference: System-level Composers.

Version History

Version Date Content
     



Last Update : 2022/01/19

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