Server Push

Let's examine what happens if we modify the UI from a separate thread without using Server Push:

@Title("Report Viewer")public class VaadinUI extends UI {    private HorizontalLayout header = new HorizontalLayout();    private MenuBar.MenuItem annualLegalReportItem;    ...    private void generateAnnualLegalReport() {        Notification.show("Report generation started",                "You'll be notified once the report is ready.", Notification.Type.TRAY_NOTIFICATION);        annualLegalReportItem.setEnabled(false);        new Thread(() -> {            ByteArrayOutputStream outputStream = AnnualLegalReport.getOutputStream();            ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());            Button button = new Button("Download Annual Legal Report", VaadinIcons. ...

Get Data-Centric Applications with Vaadin 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.