I'm trying to simulate an accelerated view of a Facebook feed, so the components must show up one by one on the page (without refreshing). The way I went about it was to create different threads that each sleep a certain amount of time and then add a Label (or something else) to the layout, but instead of these components showing up one by one, the whole UI is waiting for all the threads to finish sleeping and running. Is there a functional method of achieving this in Vaadin?
protected void init(VaadinRequest vaadinRequest) {
final VerticalLayout layout = new VerticalLayout();
setContent(layout);
layout.addComponent(new Label("this shows up first"));
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
layout.addComponent(new Label("this shows up after sleeping"));
}