Search in sources :

Example 1 with Dialog

use of com.vaadin.flow.component.dialog.Dialog in project flow by vaadin.

the class PrivateView method applyForHugeLoanUsingExecutor.

private void applyForHugeLoanUsingExecutor(ClickEvent<Button> e) {
    Dialog waitDialog = new Dialog();
    waitDialog.add(new Text("Processing loan application..."));
    waitDialog.open();
    UI ui = getUI().get();
    Runnable runnable = new Runnable() {

        @Override
        public void run() {
            try {
                bankService.applyForHugeLoan();
            } catch (Exception e) {
                getUI().get().access(() -> {
                    Notification.show("Application failed: " + e.getMessage());
                });
            }
            ui.access(() -> {
                updateBalanceText();
                waitDialog.close();
            });
        }
    };
    executor.execute(runnable);
}
Also used : UI(com.vaadin.flow.component.UI) Dialog(com.vaadin.flow.component.dialog.Dialog) Text(com.vaadin.flow.component.Text)

Aggregations

Text (com.vaadin.flow.component.Text)1 UI (com.vaadin.flow.component.UI)1 Dialog (com.vaadin.flow.component.dialog.Dialog)1