diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-09-14 16:01:16 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-09-14 16:02:35 +0300 |
commit | e6f12f49b4228425a7624b3bd5be9ad4c300b37b (patch) | |
tree | 1e4077ce2aa3d05abec7298abda2ae300791f5e4 | |
parent | 9b18b8108df0293a46e1624f10fd3ec375a4e7e1 (diff) | |
download | vaadin-framework-e6f12f49b4228425a7624b3bd5be9ad4c300b37b.tar.gz vaadin-framework-e6f12f49b4228425a7624b3bd5be9ad4c300b37b.zip |
Add UI.addCloseListener() and removeCloseListener() that were missing for some reason (#9265)
-rw-r--r-- | server/src/com/vaadin/ui/UI.java | 24 |
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)} **/ |