-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello Team,
I am evaluating ZK for our next project. I invested lot of time for other framework like Vaadin. I am pleased with the zk's capability of autowiring and the development pace it provides. But, I am seeing some serious performance issue with simple ViewModel bindings:
ComponentVM.java
package com.rs.studio.vm;
import java.util.Map;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ContextParam;
import org.zkoss.bind.annotation.ContextType;
import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.util.Clients;
public class ComponentVM {
private String name;
@Init
public void init() {
String selectedComp = Executions.getCurrent().getParameter("selectedComponent");
this.name = selectedComp;
}
@Command
@NotifyChange("Save")
public void Save() throws Exception {
System.out.println("Save something");
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
test.zul
<zk>
<include id="contentInclude" ></include>
<button id="New"
onClick='contentInclude.setSrc("/component/component.zul")' visible="true">
</button>
</zk>
component.zul
<zk>
<div apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('com.rs.studio.vm.ComponentVM') @load(vm.name) @save(vm.name, before='submit')">
<grid>
<columns>
<column></column>
<column></column>
</columns>
<rows>
<row>
<label value="Component Name"></label>
<textbox value="@bind(vm.name)"></textbox>
</row>
<row>
<cell colspan="3" style="text-align:center">
<vlayout>
<button label="Save"
onClick="@command('Save')" width="100px" height="30px" >
<attribute name="onClick">
//contentInclude.setSrc("/component/component_list.zul");
</attribute>
</button>
</vlayout>
</cell>
</row>
</rows>
</grid>
</div>
</zk>
After clicking on button I see Processing for like 10 seconds. I am running this on a 8 Core processor with 16 GB RAM and 250 GB SSD. It's a solid machine and just running zkoss in tomcat. Before implementing MVVVM I used MVM and performance was decent.
Following screenshot shows the debug output of ZK. I could not upload it here because it requires 100 Karma. ibb dot co / hu4W1v
Thanks, looking for your inputs.
I can't reproduce your issue no matter I click "New" or "Save" button. Since the command method and event listener are quite simple. It might be caused by an abnormal factor.
you can open chrome developer tool to check the timing to know why it spends 10 seconds. But if you can zk "Processing" message, that usually means zk client is waiting for a server response. So there is probably something at the server-side blocking the event execution.
You can read this doc to know how to debug a performance issue with dev tool.
Asked: 2017-09-03 16:34:47 +0800
Seen: 29 times
Last updated: Sep 04 '17
Databinding and auto-complete on combobox
Composite component and bind in ZK 6
How to detach / reattach MVVM windows?
Is there a way to resolve view model properties as input to client side javascripts?
How can I synchronize data in a ListBox in MVVM ? [closed]
MVVM Validator: class not found ? [closed]
How to Call Child ViewModel Method from Parent Window? [closed]
In your attribute viewmodel, don't put the load and save for a property. You must do that in your textbox self
chillworld ( 2017-09-03 20:49:10 +0800 )edityou now have enough karma to upload your screenshot
hawk ( 2017-09-04 08:17:35 +0800 )edit