From e6f12f49b4228425a7624b3bd5be9ad4c300b37b Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Fri, 14 Sep 2012 16:01:16 +0300 Subject: Add UI.addCloseListener() and removeCloseListener() that were missing for some reason (#9265) --- server/src/com/vaadin/ui/UI.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'server/src/com/vaadin/ui/UI.java') 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 @@ -1119,6 +1119,18 @@ public abstract class UI extends AbstractComponentContainer implements ClickListener.clickMethod); } + /** + * 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)} @@ -1140,6 +1152,18 @@ public abstract class UI extends AbstractComponentContainer implements listener); } + /** + * 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)} -- cgit v1.2.3