Envisage ZK 6: The Next Generation Data Binding System"

From Documentation
(1st draft)
 
Line 12: Line 12:
 
=Features=
 
=Features=
 
==A whole new, clean annotation expression==
 
==A whole new, clean annotation expression==
*Same Java style annotation expression: consist with Java's annotation style. For details, please refer to [link].
+
*Same Java style annotation expression in zul: The new ZK annotation is consistent with Java's annotation style. If you know the Java style, you know the ZK Style. For details, please refer to [link].
*A set of collaborated annotations: @bind(...), @converter(...), @valiator(...), @form(...)
+
*A set of collaborated annotations: ZK Bind use a set of annotations to make using data binding as intuitive and clear as possible.
 +
**@bind(...): used to bind data and command
 +
**@converter(...): used  to specify converters along with parameters
 +
**@valiator(...): used to specify validators along with parameters
 +
**@form(...): used to bind a form.
  
 
==Flexiable expressions as EL 2.2==
 
==Flexiable expressions as EL 2.2==

Revision as of 06:41, 21 October 2011

DocumentationSmall Talks2011OctoberEnvisage ZK 6: The Next Generation Data Binding System
Envisage ZK 6: The Next Generation Data Binding System

Author
Henri Chen, Principal Engineer, Potix Corporation
Date
October 21, 2011
Version
ZK 6


Introduction

This is a whole new data binding system with new specifications and implementations. Based on the experiences learned from our version one data binder and feedbacks from users' and contributors' suggestions, we have cooked this easy to use, flexible, features rich new data binding system in ZK6.

Features

A whole new, clean annotation expression

  • Same Java style annotation expression in zul: The new ZK annotation is consistent with Java's annotation style. If you know the Java style, you know the ZK Style. For details, please refer to [link].
  • A set of collaborated annotations: ZK Bind use a set of annotations to make using data binding as intuitive and clear as possible.
    • @bind(...): used to bind data and command
    • @converter(...): used to specify converters along with parameters
    • @valiator(...): used to specify validators along with parameters
    • @form(...): used to bind a form.

Flexiable expressions as EL 2.2

*ZK Bind accept EL 2.2 syntax expression that you can provide flexible operations easily. *Bind to bean properties, indexed properties, Map keys seamlessly. *Bind to component custom attributes automatically. *Bind to Spring managed bean, CDI managed bean, and so on via VariableResolver automatically

One way load only data binding

*Load when bean property changes *Conditional load before/after executing different commands

One way save only data binding

*Save when UI component attribute changes *Multiple save to different target beans *Conditional save before/after executing different commands

Initial data binding

*Load when UI components are first added into the binding system

Two way data binding

*Short expression of both save and load bindings

Bind to any attributes of the UI components

*Bind symmetrically to all attributes of UI components

Event command binding

*Bridge ZK event to command *Simple command name invocation *Automatic event listener registration

Conditional binding on command

*Different binding for different commands

Template/Collection binding

*Binding on Listbox/Grid/Tree/Combobox *Local variable scope is limited to the container component *Support index property

Form binding

*Temporary form binding to avoid immediate polution on data bean *Submit a form in a whole *Conditional save for different commands

Automatic Java annotated data dependency tracking

*Controllable load on save *@NotifyChange to notify property changes *@DependsOn to specify property change dependency

Embedded validation cycle

*Bind validator by name or by EL expression *Embedded system Validator: provide commonly used validators that user can use directly by specify the name

Enhanced converter mechanism

*Bind converter by name or by EL expression *Embedded system Converters: provide commonly used converters that user can use directly by specify the name

GenericBindComposer

*Ease UI component tree, binder, and data source association *Each binder covers only the applied component tree *Inter-BindComposer communications

Bind on demand

*Support dynamically add/remove bindings by API. *Attatched components with binding annotations are automatically managed by the existing binder if covered. *Detached components that were managed by a binder are automatically removed from the management.

Support seamless MVVM design pattern

*You can now utilize MVVM design pattern to achieve "separation of data and logic from presentation" easily with the new ZK Bind data binding system. For details about how to apply MVVM design pattern with ZK Bind, please see this series of Smalltalks[link].

The Album Example with ZK Bind

This is an example "steal" from the article Presentation Model by Martin Fowler. The use case is simple, whenever an album is selected from the