Reflect Copying process with progress bar and percentage

612 Views Asked by At

I am using ZK freamework.

I am preparing a project which copies Data from one server and pastes Data to another server. Till end project is working fine and even this is doing the work as per my expectations. I want to show a process bar with the percentage of data copying process. I am using ZK framework, Java Spring, and Mysql.

My requirement is to show the percentage of copying done and a progress bar in zk Framework. please help me through this.

Thanks in advance.

for(long j=1;j<=rowCount;j++){          
    sum = sum + j/rowCount;
    if(j==rowCount){                
    sum=100;
}   
progressMeter.setValue(sum);            
countLabel.setValue((rowCount-1)+" Rows are inserted");
BindUtils.postNotifyChange(null, null, countLabel, "_value");
2

There are 2 best solutions below

0
On

Beside mine comment,
I would like to point you to a small talk of Robert Wenzel.

He has written some code to simplify long operations and make the updating of the screen easier.

https://www.zkoss.org/wiki/Small_Talks/2015/January/Simplify_Long_Operation_Handlings

Check it out and maybe you could use it in your application.

5
On

In ZK framework you need to use Progressmeter component. In your example.zul you need to add the following code :

 <progressmeter id="uploadProgress" value="0" width="300px" />

And in your project class you need to update value of this component.

    public class ProgressmeterController extends SelectorComposer<Hlayout> {
    @Wire
    private Progressmeter uploadProgress;

    @Wire
    private Timer timer;

    @Listen("onTimer = #timer")
    public void fetchingSimulatorTimer() {
        //calculate completed percent
        uploadProgress.setValue(percent);
        }
}