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);
}