zk framework : zul file, pure java or hybrid for better performance

asyard picture asyard · Feb 13, 2013 · Viewed 8.1k times · Source

zk framework is very flexible for web developers. But flexibility also brings some issues. I wonder which method is the best for performance (memory, time etc.)

1) .zul files, that consists scripts like :

<vbox>
        Auto-complete Combobox:
        <combobox id="combo" autodrop="true" mold="rounded"/>
        <hbox>
            <checkbox checked="true"
                onCheck="combo.autodrop = self.checked"
                label="auto drop popup when typing" />
            <checkbox checked="true"
                onCheck="combo.buttonVisible = self.checked" label="button visible" />          
        </hbox>
        <checkbox label="Use rounded combobox" checked="true"
            onCheck='combo.mold=self.checked? "rounded": "default"'/>
    </vbox>
    <zscript>
    String[] _dict = { 
        "abacus", "accuracy", "acuity", "adage", "afar", "after", "apple",
        "bible", "bird", "bingle", "blog"
...

2) pure java like

public class TestRenderer {

    ListModelList model = new ListModelList();
    private AnnotateDataBinder binder;

    @AfterCompose
    public void afterCompose(@ContextParam(ContextType.VIEW) Component view) {
        binder = new AnnotateDataBinder(view);
     List persons = new ArrayList();    
     model.add(new Person("David", "Coverdale"));
...

3) hybrid zk

<window apply="com.synnex.wms.outbound.so.IndexViewCtrl">
    <style>
        .z-row-cnt .z-label {
            white-space:nowrap;
        }
    </style>
    <grid model="${model}" rowRenderer="${renderer }" height="300px" width="800px">
        <custom-attributes org.zkoss.zul.grid.rod="true" />
        <custom-attributes org.zkoss.zul.grid.initRodSize="20" />
        <columns>
            <column forEach="${headers}" label="${each}" width="80px"/>
        </columns>

    </grid>


</window>

are they differ when using with different technologies like spring? is java to html parsing faster than zul to html?

Answer

Subodh Joshi picture Subodh Joshi · Feb 14, 2013

I will suggest you to use MVVM Architecture it will boost up your development as i worked on ZK MVC as well as MVVM i will prefer MVVM Architecture you can take maximum benefits of Component based programming with this approach otherwise if your project is complex and your are using MVC Architecture you are increasing your headache but some time we have to use MVC approach also but from my understanding best approach will be MVVM