appreciated / vaadin-app-layout

<app-layout> integration for Vaadin 8.1+, 10+ and 14+
Apache License 2.0
83 stars 44 forks source link

NotificationHolder #165

Closed alabotski closed 5 years ago

alabotski commented 6 years ago

Some questions

1 What is different between DefaultNotificationHolder and DefaultBadgeHolder?

2 How properly use DefaultNotificationHolder from View?

For example

https://github.com/appreciated/vaadin-app-layout/blob/master/app-layout-addon/src/test/java/com/github/appreciated/MainView.java DefaultNotificationHolder notificationHolder

So I want add notifications from View2 for example.

alabotski commented 6 years ago

Nobody knows? (

appreciated commented 6 years ago

@LeshaRB Sorry for keep you waiting, but I wanted to give a proper example, and I'm currently rather busy with other things.

1 What is different between DefaultNotificationHolder and DefaultBadgeHolder?

The difference is that the NotificationHolder can hold Notifications (f.e. Title + Description) and will keep track on how many are unread, order them by priority and time they were inserted (imaging a kind of news ticker) and display the unread count in a "badge". The BadgeHolder will only hold a plain number and bind it to a "badge".

2 How properly use DefaultNotificationHolder from View?

I will put a proper example example together, but this will require some time. I must admit that the access from the Views is rather problematic and currently probably rather dirty. Maybe @svenruppert has an clever idea how to make them easily accessible for the Views.

alabotski commented 6 years ago

Thank you

Will be wait @svenruppert advice

svenruppert commented 6 years ago

@LeshaRB , let´s wait a little bit, please.. I just started some internal refactorings. After this, we should have a detailed look at this.

appreciated commented 5 years ago

Postponed to 2.05.

appreciated commented 5 years ago

2 How properly use DefaultNotificationHolder from View?

Badges:

Use the following class AppLayoutBadges to set the BadgeHolder (via AppLayoutBadges::addBadgeWithIdentifier(holder,<String identifier>)) in your AppLayoutRouterLayout and access it from any view via `AppLayoutBadges::getBadge() as long as your are running the command from an UI thread.

Notifications:

Use the following class AppLayoutNotification to set the NotificationHolder (via AppLayoutNotification::setNotificationHolder) in your AppLayoutRouterLayout and access it from anywhere via AppLayoutNotification::getNotificationHolder() as long as your are running the command from an UI thread.