Binder parses ZK bind annotations on ZULs to establish data binding relationship between components and ViewModel. It also synchronizes data between ZUL(View) and ViewModel based on the binding relationship and forwards events to ViewModel's command method.
Typically ViewModel is just a POJO. As it has no knowledge about others, a ViewModel can only communicate with another one by binder. The binder is like a broker and uses ViewModel's meta data(annotation) and methods to help it communicate with others. By default a binder subscribes to a desktop-scoped event queue, thus event queue is a common communication mechanism among binders. There are 2 features: global command binding and dynamic change notification that operate based on this mechanism.
ZK also allows you to change default queue name and scope that a binder subscribes. You can separate binders into different groups by changing queue's name and scope upon your requirement.The syntax is as follows:
<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('foo.MyViewModel')" binder="@init(queueName='myqueue')"> <window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('foo.MyViewModel')" binder="@init(value='xxx.MyBinder', queueScope='session')">
For available scopes, please refer ZK Developer's Reference/Event Handling/Event Queues.
For binder class customization(This feature is reserved for framework architect, NOT recommended for app developer!), your implementation must extends AnnotateBinder
|6.0.0||February 2012||The MVVM was introduced.|