Data Binding"

From Documentation
Line 1: Line 1:
 
{{ZKComponentReferencePageHeader}}
 
{{ZKComponentReferencePageHeader}}
  
Data binding synchronizes data between View and ViewModel according to component definition's annotation. The annotation specifies when to save (or load) which attribute, how to convert, validate and render the data. It can be found in <tt> metainfo\zk\lang-addon.xml </tt> of zkbind.jar. Please refer to [[ZK Client-side Reference/Language Definition]] about how to configure language definition and its addon.  
+
Data binding synchronizes data between View and ViewModel according to component definition's annotation. The annotation specifies when to save (or load) which attribute, how to convert, validate and render the data. It can be found in <tt> metainfo\zk\lang-addon.xml </tt> of zkbind.jar. Please refer to [[ZK Client-side Reference/Language Definition]] about how to configure language definition and its addon. If you want data binding can works on your newly-created component, you should define its own annotations.
  
  
Line 10: Line 10:
 
! <center>Attribute Name</center> !! <center>Description</center>
 
! <center>Attribute Name</center> !! <center>Description</center>
 
|-  
 
|-  
| &nbsp;ACCESS || &nbsp; Access privilege. The value can be "both", "save", "load"(default value); default value is used if not specify.
+
| &nbsp;ACCESS || &nbsp; Access privilege. The value can be "both", "save", or "load"('''default value'''); default value is used if not specify.
 
|-
 
|-
 
| &nbsp;CONVERTER  || &nbsp; System converter for special properties. e.g. SelectedItem in listbox. see <javadoc> org.zkoss.bind.converter.sys.ListboxSelectedItemConverter </javadoc>
 
| &nbsp;CONVERTER  || &nbsp; System converter for special properties. e.g. SelectedItem in listbox. see <javadoc> org.zkoss.bind.converter.sys.ListboxSelectedItemConverter </javadoc>
Line 16: Line 16:
 
| &nbsp;VALIDATOR  || &nbsp; System validator for special properties.
 
| &nbsp;VALIDATOR  || &nbsp; System validator for special properties.
 
|-  
 
|-  
|  &nbsp;SAVE_EVENT || Save trigger event. It's meaningful only when ACCESS attribute is "both" or "save".
+
|  &nbsp;SAVE_EVENT || &nbsp; Save trigger event. It takes effect only when ACCESS attribute is "both" or "save".
 
|-
 
|-
|  &nbsp;LOAD_EVENT||  
+
|  &nbsp;LOAD_EVENT|| &nbsp; Load trigger event;  It takes effect only when ACCESS attribute is "both" or "load".
 
|-
 
|-
|  &nbsp;LOAD_REPLACEMENT||  
+
|  &nbsp;LOAD_REPLACEMENT|| &nbsp;
 
|-
 
|-
|  &nbsp;LOAD_TYPE||  
+
|  &nbsp;LOAD_TYPE|| &nbsp;
 
|-
 
|-
|  &nbsp;SAVE_REPLACEMENT||  
+
|  &nbsp;SAVE_REPLACEMENT|| &nbsp;
 
|-
 
|-
|  &nbsp;RENDERER||  
+
|  &nbsp;RENDERER|| &nbsp;
 
|-
 
|-
 
|}
 
|}
  
 +
 +
<source lang="xml">
 +
 +
<component>
 +
<component-name>textbox</component-name>
 +
<extends>textbox</extends>
 +
<annotation>
 +
<annotation-name>ZKBIND</annotation-name>
 +
<property-name>value</property-name>
 +
<attribute>
 +
<attribute-name>ACCESS</attribute-name>
 +
<attribute-value>both</attribute-value>
 +
</attribute>
 +
<attribute>
 +
<attribute-name>SAVE_EVENT</attribute-name>
 +
<attribute-value>onChange</attribute-value>
 +
</attribute>
 +
<attribute>
 +
<attribute-name>LOAD_REPLACEMENT</attribute-name>
 +
<attribute-value>rawValue</attribute-value>
 +
</attribute>
 +
<attribute>
 +
<attribute-name>LOAD_TYPE</attribute-name>
 +
<attribute-value>java.lang.String</attribute-value>
 +
</attribute>
 +
</annotation>
 +
</component>
 +
 +
</source>
  
  

Revision as of 03:47, 9 February 2012

Data binding synchronizes data between View and ViewModel according to component definition's annotation. The annotation specifies when to save (or load) which attribute, how to convert, validate and render the data. It can be found in metainfo\zk\lang-addon.xml of zkbind.jar. Please refer to ZK Client-side Reference/Language Definition about how to configure language definition and its addon. If you want data binding can works on your newly-created component, you should define its own annotations.


ZKBIND zkbind system's annotation name

Attribute Name
Description
 ACCESS   Access privilege. The value can be "both", "save", or "load"(default value); default value is used if not specify.
 CONVERTER   System converter for special properties. e.g. SelectedItem in listbox. see ListboxSelectedItemConverter
 VALIDATOR   System validator for special properties.
 SAVE_EVENT   Save trigger event. It takes effect only when ACCESS attribute is "both" or "save".
 LOAD_EVENT   Load trigger event; It takes effect only when ACCESS attribute is "both" or "load".
 LOAD_REPLACEMENT  
 LOAD_TYPE  
 SAVE_REPLACEMENT  
 RENDERER  


	<component>
		<component-name>textbox</component-name>
		<extends>textbox</extends>
		<annotation>
			<annotation-name>ZKBIND</annotation-name>
			<property-name>value</property-name>
			<attribute>
				<attribute-name>ACCESS</attribute-name>
				<attribute-value>both</attribute-value>
			</attribute>
			<attribute>
				<attribute-name>SAVE_EVENT</attribute-name>
				<attribute-value>onChange</attribute-value>
			</attribute>
			<attribute>
				<attribute-name>LOAD_REPLACEMENT</attribute-name>
				<attribute-value>rawValue</attribute-value>
			</attribute>
			<attribute>
				<attribute-name>LOAD_TYPE</attribute-name>
				<attribute-value>java.lang.String</attribute-value>
			</attribute>
		</annotation>
	</component>


Version History

Last Update : 2012/02/09


Version Date Content
     




Last Update : 2012/02/09

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