2
    @GlobalCommand
    @Command
    @NotifyChange("*")
    public void makeProgress(){
        int progress = getProgress();
        if(progress == 100){
            return;
        }
        progress++;
            Thread.sleep(100); // do some part of time consuming work

        setProgress(progress);

        BindUtils.postGlobalCommand(null, null, "makeProgress", null);
    }

Zul

<window apply="org.zkoss.bind.BindComposer"
    viewModel="@id('vm') @init('com.javaBean')">
        <progressmeter value="@bind(vm.progress)" width="300px" />
        <button onClick="@command('makeProgress')"></button>
</window>

I want to keep the user updated with the % of work done. (I am using mvvm model)
So i created a progressmeter whose value is bind.
and a button , when click start the process.
In makeProgress() i do some part of work and post a command.

I am expecting it to show progress bar incremented by one after every 100 millisecond. But when i tried it the progress bar directly show 100% after 10 sec(100 ms wait * 100).

What am i missing ?

Or there is better approach to do this ?

Bhuvan
  • 4,028
  • 6
  • 42
  • 84

1 Answers1

0

Not sure if that worked.. If you need the progress bar to get updated automatically, you may have to use SelectorComposer instead of BindComposer. SelectComposer can push the data to the client. You can have timer running @interval and keep updating the data.