In ZK 6 RC, we introduced various new features including ZK Bind, Generic enhancements, jQuery & CSS3 style server-side selectors, advanced templates etc. Thanks to the enthusiastic response and feedback from the community, as of the release of ZK 6 RC2, we are able to make some changes to suit and serve the needs of the community better. This blog will specifically talk about refinements of ZK Bind syntax and component selectors.
ZK Bind Syntax
In regards to syntax in ZUL, the following adjustments were made including the refinement of annotations for specific names while the rules of some expressions were simplified;
- Syntax to assign a ViewModel has been changed
- Syntax to binding a command has been changed
- @bind() is now for non-command binding only, before|after ‘cmd’ no longer exist in bind()
i. For load-binding, use @load(expression, after=’cmd’, before=’cmd’), ‘before’ and ‘after’ are optional
ii. For save-binding, use @save(expression, after=’cmd’, before=’cmd’), ‘before’ and ‘after’ are optional
iii. @bind(expression) equals @load(expression) @save(expression) without ‘before’ and ‘after’ condition.
- @form() has been removed, use form=”@id()…” instead
ZK 6 RC: self=”@form(id=’fx’, vm.selected, save=vm.selected before ‘cmd’)
ZK 6 RC2: form=”@id(‘fx’) @load(vm.selected) @save(vm.selected, before=’cmd’)
In terms of Java, in order to provide more specific features and clearer package, the following changes has been made;
- @NotifyChange and @DependsOn have been moved from org.zkoss.bind to org.zkoss.bind.annotation
- For a command method, add the @Command annotation. With this annotation, binder can provide more features, such as @Param and @Default for acquiring argument of the context as the method parameter. We will talk about these in upcoming small talks
- zbind.jar has been renamed to zkbind.jar, please remember to remove zbind.jar after upgrading to RC2
- Maven artifactId(zbind) has been renamed to zkbind, please remember to change the pom.xml dependency if in use
Regarding component selectors, for better naming and clearer package structure to avoid confusion, the following changes have been made;
- GenericAnnotatedComposer is renamed to SelectorComposer
- Annotations (@Wire, @WireXel, @WireZScript, @Listen) are moved from package org.zkoss.zk.ui.select to org.zkoss.zk.ui.select.annotation
Once again, the ZK Team appreciates the feedback and response from the community. As of today, ZK6 RC2 is now released, please try it out or check out the release note for new features and more.