Displaying Information in a Grid Using Data Binding

From Documentation
Revision as of 02:05, 15 October 2010 by Sphota (talk | contribs)

Displaying Information in a Grid Using Data Binding

In the section Displaying Information Using Grid, we devised a renderer to associate the View (Product View Grid) with a data model. In this section, we'll look into how we could automate that process with ZK's annotated data binding mechanism.

The Concept of Data Binding

ZK's annotated data binding mechanism involves the following players to make it work:

  • Data Bean
  • ZK UI Components declared in ZUL file
  • ZK's annotated data binding manager utility

In a nutshell, a bean's particular property is associated with a specified component attribute, such that whenever a value is modified, the annotated data binding manager calls the data bean's getter and setter methods to keep the values in sync between the bean and the component.
The syntax for declaring this association in ZUML is

<component-name attribute-name="@{bean-name.attribute-name}"/>

Implementing Data Binding

Converting Bean Types for Display