Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Notification convenience methods #20892

Open
simasch opened this issue Jan 22, 2025 · 3 comments
Open

Add Notification convenience methods #20892

simasch opened this issue Jan 22, 2025 · 3 comments

Comments

@simasch
Copy link

simasch commented Jan 22, 2025

The Notification.show method is very limited and I always have to add a custom Notification class with methods like success, error, warning etc.

And there I do

Notification notification = new Notification("The requested employee was not found", 3000, Notification.Position.TOP_END);
notification.addThemeVariants(NotificationVariant.LUMO_ERROR);
notification.open();

It would be great if the Notification class could already have those methods.

@knoobie
Copy link
Contributor

knoobie commented Jan 22, 2025

Notification are a good example for a builder pattern IMHO. I've created my own NotificationBuilder for our applications where I can specificy globally (based on type (success / error and so on)) timeout, styles and "closeability" so that only the type and content has to be specified.

@simasch
Copy link
Author

simasch commented Jan 22, 2025

Indeed, but the builder would not solve my problem.

It should support both, a builder and default static methods for info, success, warning, and error.

@rucko24
Copy link

rucko24 commented Jan 22, 2025

Likewise, I had created a Builder for notifications, but in the end, I created another simple one for the ConfirmDialog with pattern builder as well...

I have created something not so perfect, but it works for the moment...

I also agree, show info, warning etc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants