zk viewmodel or selectorcomposer -
im newbie in zk´s world, have doubt... read zk 8 documentation (almost all). @ office partners using viewmodel inside components using composer (selectorcomposer) bind elements this:
<div apply="org.zkoss.bind.bindcomposer" viewmodel="@id('vm') @init('com.some.package.someviewmodel')"> <vbox> ... elements .... <div apply="com.some.package.somecomposer"> <hbox> <vbox> <checkbox ... more code... </checkbox> </vbox> </hbox> </div> </vbox> </div>
i read if apply selectorcomposer lost coupling... reason of taking selectcomposer within viewmodel? or how works?
thanks lot help.
from point of view selectcomposer
allow reuse java code in traditional way. example can defined abstractcontroller
functionality reused in other controls of same type different functionality , extend abstractcontroller
. in approach can control lifecycle of componente implemented methods of selectcomposer
doaftercompose
. can same thing pure mvvm, instead of implement methods of selectcomposer
should use annotations @aftercompose
or @init
, can extend base class well, use view have change tag in zul file like:
<include src="/artifacts/componente_to_reuse.zul"/>
i think matter of preferences, preferred (and recommend) use pure mvvm since available, , haven't found functionality couldn't reuse mvvm approach.
references: include, zk annotations
Comments
Post a Comment