im newbie in zk´s world, so i have a doubt... i read already zk 8 documentation (almost all). At the office some partners are using ViewModel but inside some components are using Composer (selectorComposer) to bind some elements like this:
<div apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('com.some.package.SomeViewModel')">
<vbox>
... SOME ANOTHER ELEMENTS ....
<div apply="com.some.package.SomeComposer">
<hbox>
<vbox>
<checkbox ... more code...
</checkbox>
</vbox>
</hbox>
</div>
</vbox>
</div>
i read that if you apply SelectorComposer you lost coupling... so what is the reason of taking SelectComposer within a ViewModel? or how it works?
Thanks a lot for any help.
From my point of view
SelectComposerallow you to reuse java code in a very traditional way. For example you can defined anAbstractControllerwith functionality that will be reused in other controls of the same type with an slightly different functionality and extend theAbstractController. In this approach you can control the lifecycle of the componente by implemented the methods ofSelectComposerlikedoAfterCompose. But actually you can do the same thing with pure MVVM, but instead of implement methods ofSelectComposeryou should use the annotations like@AfterComposeor@Initand you can extend the base class as well, to use your view you just have to change the tag in the zul file with something like:I think is just a matter of preferences, I preferred (and I always recommend) to use pure MVVM since it was available, and I haven't found any functionality that I couldn't reuse with MVVM approach.
References: Include, Zk annotations