Dialog o Notification

Is it possible to close the dialog after some time? I’d like it to have the same behavior as the notification. Or is there a way that the notification closes when a click is triggered from elsewhere in the view.

You can set:

setCloseOnOutsideClick(true);

on the Dialog

But I need set the duration of open dialog for 5 second or use in notification component setCloseOnOutsideClick

Oh then it was a missunderstanding

You can start a thread and wait for 5 seconds and then close the dialog

You have an example?

You can use the ThreadPoolTaskExecutor from Spring and start a task. Then sleep in the task and after the sleep you must call

UI.getCurrent().access(() -> { dialog.close() });

First you have to add @EnableScheduling to your SpringBootApplication class

Here’s the example

https://github.com/simasch-scratches/dialog-timer

It’s important to add

@Push
@EnableScheduling

and the rest you’ll find in HelloWorldView

Thank you very much and I will try your resolution