summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/UI.java
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/com/vaadin/ui/UI.java')
-rw-r--r--server/src/com/vaadin/ui/UI.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index 41d0c43399..7f0710c813 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -1120,6 +1120,18 @@ public abstract class UI extends AbstractComponentContainer implements
}
/**
+ * Adds a close listener to the UI. Close listeners are invoked when the UI
+ * is removed from the session due to UI or session expiration.
+ *
+ * @param listener
+ * The CloseListener that should be added.
+ */
+ public void addCloseListener(CloseListener listener) {
+ addListener(CloseEvent.CLOSE_EVENT_IDENTIFIER, CloseEvent.class,
+ listener, CloseListener.closeMethod);
+ }
+
+ /**
* @deprecated Since 7.0, replaced by
* {@link #addClickListener(ClickListener)}
**/
@@ -1141,6 +1153,18 @@ public abstract class UI extends AbstractComponentContainer implements
}
/**
+ * Removes a close listener from the UI, if previously added with
+ * {@link #addCloseListener(CloseListener)}.
+ *
+ * @param listener
+ * The CloseListener that should be removed
+ */
+ public void removeCloseListener(CloseListener listener) {
+ removeListener(CloseEvent.CLOSE_EVENT_IDENTIFIER, CloseEvent.class,
+ listener);
+ }
+
+ /**
* @deprecated Since 7.0, replaced by
* {@link #removeClickListener(ClickListener)}
**/