Update client side

Help me,

I need update a client side during a slow server process.

In main application I have a icePush component:

private ICEPush icepush = new ICEPush();

init method:
final Window main = new Window(“Main window”);

@Override
public void init() {
    setMainWindow(main);
    Global.setMainWin(main);
    .....
    main.addComponent(icepush);

    .....

A class named Global have a static Window declaration “mainWin” that receive a main window

Main application implements a interface used to access a push component (one icepush component used in all application)

interface:

public interface MainInterface {
void pushData();
}

Method in main application that push data

public void pushData() {
    icepush.push();
}

In a child window:

Label labelToUpdate = new Label("display a count");

 init method:
    labelToUpdate.setImmediate(true);

Listener for delete button:

    btn.addListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
                    ConfirmDialog.show(Global.getMainWin(),"Confirm","Delete this record?","Yes","No",
                            new ConfirmDialog.Listener() {
                                public void onClose(ConfirmDialog dialog) {
                                    ((MainInterface)Globals.getMainWin().getApplication()).pushData(); // DO NOTHING
                                    if (dialog.isConfirmed()) {
                                        if (confirmDelete());
                                    }
                                }
                            });
                }
            }
        }
    });

confirm delete method:

private boolean confirmDelete() {
    ((MainInterface)Globals.getMainWin().getApplication()).pushData(); // DO NOTHING ?? - a confirmDialog popup stay visible
    labelToUpdate.setValue("Change a label to test"); // 
    ((MainInterface)Globals.getMainWin().getApplication()).pushData();  // DO NOTHING - a label text don´t change

// here a confirmDialog window remains visible in the browser and labelToUpdate don´t change

        // force a slow process to test
        PersonDao personDao = new PersonDao();
        for (int i=0; i< 1000; i++) {
            Person person = personDao.getPerson(i);
            labelToUpdate.setValue("search "+i); // DO NOTHING
            labelToUpdate.requestRepaint();
            ((MainInterface)Globals.getMainWin().getApplication()).pushData(); // DO NOTHING
        }
        return true;
    }
}

After this process a client side label value is update to “search 999”

my web.xml

VaadinApplication
org.vaadin.artur.icepush.ICEPushServlet

    <init-param>
        <param-name>application</param-name>
        <param-value>Main</param-value>
    </init-param>

I´m tried all possible solution without success (inclusive use refresher component, but during slow process it stop).

What is wrong? Can someone help me?

Thanks.

Your slow process MUST run in a separate thread. Otherwise the pusher (or the refresher) do not get an opportunity to run and will not send information to the browser.

A simple way to create a thread is as follows – create a runnable object and move your code to its “run” method.
Once you have a runnable object, you can create a Thread to execute it, and start the thread.

 new Thread(new Runnable() {
     @Override
    public void run() {
        // long running process goes here.
    }
}).start();

See also
this thread
for some more information. You do have to synchronize any (direct or indirect) interaction with UI components to the application instance.

Thanks a lot! It works!

I am very grateful.