Data Binding"

From Documentation
m
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
{{ZKDevelopersReferencePageHeader}}
 
{{ZKDevelopersReferencePageHeader}}
 +
{{Deprecated | url=[http://books.zkoss.org/zk-mvvm-book/8.0/syntax/data_binding.html zk-mvvm-book/8.0/syntax/data_binding]|}}
  
  
In the following sections, we'll cover syntax of all ZK Bind's annotations used on a ZUL. They are all used in '''component's attribute''' and have similar format:
+
In the following sections, we'll cover ZK Bind's annotations used on a ZUL. They are all used in '''component's attribute''' and have general format described in [[ZK_Developer%27s_Reference/Annotations/Annotate_in_ZUML| Annotate in ZUML]]:
  
Basically, the syntax consists of an annotation with comma-separated key-value pairs. The binder treats value of a key as an EL expression, and sets an EL expression without a key to default key's value. All annotations requires at least default key's value.
+
'''@AnnotationName(''attr-value1, attr-name2=attr-value2'')'''
  
* '''<tt>@</tt>''[Annotation]''<tt>( </tt> ''[EvaluateOnce EL-expression]'' <tt>) </tt> '''
+
'''@AnnotationName(''attr-name1={attr-value1-1, attr-value1-2}, attr-name2=attr-value2'')'''
  
;''[Annotation]''  
+
Basically, the syntax consists of an annotation name with comma-separated key-value pairs. The binder treats an annotation's attribute value as an EL expression, and sets an EL expression without a attribute name to default attribute name "value". All annotations must define default attribute's value.
 +
 
 +
For each ZK Bind supported annotation, the way a binder evaluates an EL expression is slightly different. Some annotation's EL expressions are evaluated only once like <tt>@id</tt> and <tt>@init</tt>. some annotations have reserved attribute names, "before" and "after", like <tt>@load</tt> and <tt>@save</tt>.
 +
 
 +
 
 +
<!--
 +
 
 +
 
 +
* '''<tt>@</tt>''[AnnotationName]''<tt>( </tt> ''[EvaluateOnce EL-expression]''  <tt>) </tt> '''
 +
 
 +
;''[AnnotationName]''  
 
: It could be one of [ '''id | init ''' ]
 
: It could be one of [ '''id | init ''' ]
  
Line 18: Line 29:
  
  
* '''<tt>@</tt>''[Annotation]''<tt>( </tt> ''[EL-expression]''  <tt>) </tt> '''
+
* '''<tt>@</tt>''[AnnotationName]''<tt>( </tt> ''[EL-expression]''  <tt>) </tt> '''
  
;''[Annotation]''  
+
;''[AnnotationName]''  
: It could be one of [ ''' bind | template''' ]
+
: It could be one of [ ''' bind | template | ref''' ]
  
 
;''[EL-expression]''  
 
;''[EL-expression]''  
Line 29: Line 40:
  
  
* '''<tt>@</tt>''[Annotation]''<tt>( </tt> ''[EL-expression], [conditionKeyword]=[EvaluateOnce EL-expression]''  <tt>) </tt> '''
+
* '''<tt>@</tt>''[AnnotationName]''<tt>( </tt> ''[EL-expression], [conditionKeyword]=[EvaluateOnce EL-expression]''  <tt>) </tt> '''
  
;''[Annotation]''  
+
;''[AnnotationName]''  
 
: It could be one of [ '''load | save ''' ]
 
: It could be one of [ '''load | save ''' ]
  
Line 47: Line 58:
  
  
* '''<tt>@</tt>''[Annotation]''<tt>( </tt> ''[EL-expression], [arbitraryKey]=[EL-expression]''  <tt>) </tt> '''
+
* '''<tt>@</tt>''[AnnotationName]''<tt>( </tt> ''[EL-expression], [arbitraryKey]=[EL-expression]''  <tt>) </tt> '''
  
;''[Annotation]''  
+
;''[AnnotationName]''  
 
: It could be one of [ '''command | global-command | validator | converter ''' ]
 
: It could be one of [ '''command | global-command | validator | converter ''' ]
  
Line 60: Line 71:
 
: It could be any name, it's used as a key for parameter related Java annotation in a ViewModel.
 
: It could be any name, it's used as a key for parameter related Java annotation in a ViewModel.
  
 
+
-->
  
  
 
{{ZKDevelopersReferenceHeadingToc}}
 
{{ZKDevelopersReferenceHeadingToc}}
 
{{ZKDevelopersReferencePageFooter}}
 
{{ZKDevelopersReferencePageFooter}}

Revision as of 08:05, 28 May 2015

Stop.png This article is out of date, please refer to zk-mvvm-book/8.0/syntax/data_binding for more up to date information.


In the following sections, we'll cover ZK Bind's annotations used on a ZUL. They are all used in component's attribute and have general format described in Annotate in ZUML:

@AnnotationName(attr-value1, attr-name2=attr-value2)

@AnnotationName(attr-name1={attr-value1-1, attr-value1-2}, attr-name2=attr-value2)

Basically, the syntax consists of an annotation name with comma-separated key-value pairs. The binder treats an annotation's attribute value as an EL expression, and sets an EL expression without a attribute name to default attribute name "value". All annotations must define default attribute's value.

For each ZK Bind supported annotation, the way a binder evaluates an EL expression is slightly different. Some annotation's EL expressions are evaluated only once like @id and @init. some annotations have reserved attribute names, "before" and "after", like @load and @save.



Subsections:



Last Update : 2015/05/28

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