How to display message

I want to display one message, then generate data, then display second message. I use code listed belove. Unfortunatelly both messages are displayed together after data are generated. :-((


        showNotification("Generating test data, please wait...");
        Currency entity = null;
        for (int i = 1; i <= Integer.parseInt(count); i++) {
            entity = (Currency) container.addEntity();
            entity.setCode("C" + Integer.toString(i));
            entity.setName("ccy-" + Integer.toString(i));
        }
        showNotification("Test data generated...");

Hi,

if you add two or more notifications in a single server-roundtrip like in your example code, they are indeed shown on top of each other. Please read the “Doing Heavy Computation” part in the Book of Vaadin
here
. In short, you should create a thread to do the “heavy computation”, display the first notification when starting that thread (from e.g. a ClickListener) and display the second one when the thread is finished. ProgressIndicator will keep polling the server so that the UI will be updated with the new notification (and possible other UI changes) when needed. You can also hide the ProgressIndicator via css if you do not want it to be visible to the user; the polling will still function normally.


Tepi