Improving the application's startup time
In this recipe, we will show how to optimize widget set loading strategies. We will show how to speed up the starting of a Vaadin application by reducing the number of widgets that are initially downloaded from the server. A widget is a client-side implementation of a component, whic needs to be downloaded to the client browser.
First, we will create a simple UI class, which we are going to optimize:
public class MyVaadinUI extends UI { @Override protected void init(VaadinRequest request) { new WidgetSetOptimizer().extend(this); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); setContent(layout); Button button = new Button("Click Me"); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { layout.addComponent(new Label("Thank you for clicking")); } }); layout...