summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/notification/NotificationConnector.java32
1 files changed, 23 insertions, 9 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/notification/NotificationConnector.java b/client/src/main/java/com/vaadin/client/ui/notification/NotificationConnector.java
index 038d70dbf3..a0c49af8a3 100644
--- a/client/src/main/java/com/vaadin/client/ui/notification/NotificationConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/notification/NotificationConnector.java
@@ -36,6 +36,8 @@ import com.vaadin.ui.Notification;
@Connect(value = Notification.class)
public class NotificationConnector extends AbstractExtensionConnector {
+ private VNotification notification;
+
@Override
public NotificationState getState() {
return (NotificationState) super.getState();
@@ -44,21 +46,33 @@ public class NotificationConnector extends AbstractExtensionConnector {
@Override
protected void extend(ServerConnector target) {
NotificationState state = getState();
- VNotification n = VNotification.showNotification(
- target.getConnection(),
- state.caption, state.description,
- state.htmlContentAllowed, getResourceUrl("icon"),
- state.styleName, state.position, state.delay);
+ notification = VNotification.showNotification(target.getConnection(),
+ state.caption, state.description, state.htmlContentAllowed,
+ getResourceUrl("icon"), state.styleName, state.position,
+ state.delay);
- n.addCloseHandler(new CloseHandler<PopupPanel>() {
+ notification.addCloseHandler(new CloseHandler<PopupPanel>() {
@Override
public void onClose(CloseEvent<PopupPanel> event) {
- NotificationServerRpc rpc =
- getRpcProxy(NotificationServerRpc.class);
- rpc.closed();
+ if (getParent() == null) {
+ // Unregistered already
+ return;
+ }
+ NotificationServerRpc rpc = getRpcProxy(
+ NotificationServerRpc.class);
+ rpc.closed();
+ notification = null;
}
});
}
+ @Override
+ public void onUnregister() {
+ super.onUnregister();
+ if (notification != null) {
+ notification.hide();
+ notification = null;
+ }
+ }
}