From 113e528616e4e4575f28baff2885cdaa070e28aa Mon Sep 17 00:00:00 2001 From: Melanie Retter Date: Fri, 23 Dec 2016 13:41:46 +0100 Subject: [PATCH] Event notification window closes if focus is lost Signed-off-by: Melanie Retter --- .../hawkbit/ui/components/NotificationUnreadButton.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/NotificationUnreadButton.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/NotificationUnreadButton.java index 429dc943b7..979e9ba5bf 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/NotificationUnreadButton.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/NotificationUnreadButton.java @@ -17,6 +17,7 @@ import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider; import org.springframework.beans.factory.annotation.Autowired; +import com.vaadin.event.FieldEvents.BlurEvent; import com.vaadin.navigator.View; import com.vaadin.server.FontAwesome; import com.vaadin.spring.annotation.SpringComponent; @@ -94,6 +95,11 @@ private void createNotificationWindow() { notificationsWindow.setDraggable(false); notificationsWindow.setId(UIComponentIdProvider.NOTIFICATION_UNREAD_POPUP_id); notificationsWindow.addCloseListener(event -> refreshCaption()); + notificationsWindow.addBlurListener(this::closeWindow); + } + + private void closeWindow(final BlurEvent event) { + getUI().removeWindow((Window) event.getComponent()); } private void toggleWindow(final ClickEvent event) {