diff options
author | Aleksi Hietanen <aleksi@vaadin.com> | 2016-09-23 13:14:52 +0300 |
---|---|---|
committer | Denis Anisimov <denis@vaadin.com> | 2016-09-29 13:14:35 +0000 |
commit | 2bee988272657df4d886ea79b04be9fbc54d3928 (patch) | |
tree | 6825ec60243faac7fd4114928090e115e2e11d01 /server/src/main/java/com/vaadin/ui/GridLayout.java | |
parent | 599b61bc8598db35fa111880dd4db57f9da2adda (diff) | |
download | vaadin-framework-2bee988272657df4d886ea79b04be9fbc54d3928.tar.gz vaadin-framework-2bee988272657df4d886ea79b04be9fbc54d3928.zip |
Unify listeners on the server side
This patch updates server side add*Listener methods to return
a registration object and deprecates their corresponding
remove*Listener methods.
Additionally this patch removes add/removeListener methods which were
deprecated in 7.0.
Change-Id: I26ac5f11882512288fbbf601c7cb2aaff653ec76
Diffstat (limited to 'server/src/main/java/com/vaadin/ui/GridLayout.java')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/GridLayout.java | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/server/src/main/java/com/vaadin/ui/GridLayout.java b/server/src/main/java/com/vaadin/ui/GridLayout.java index 6e74071f65..40b8575c36 100644 --- a/server/src/main/java/com/vaadin/ui/GridLayout.java +++ b/server/src/main/java/com/vaadin/ui/GridLayout.java @@ -27,6 +27,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; import org.jsoup.nodes.Attributes; @@ -39,6 +40,7 @@ import com.vaadin.event.LayoutEvents.LayoutClickNotifier; import com.vaadin.shared.Connector; import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.Registration; import com.vaadin.shared.ui.MarginInfo; import com.vaadin.shared.ui.gridlayout.GridLayoutServerRpc; import com.vaadin.shared.ui.gridlayout.GridLayoutState; @@ -445,6 +447,7 @@ public class GridLayout extends AbstractLayout return components.size(); } + @Override public void beforeClientResponse(boolean initial) { super.beforeClientResponse(initial); @@ -1163,38 +1166,21 @@ public class GridLayout extends AbstractLayout } @Override - public void addLayoutClickListener(LayoutClickListener listener) { + public Registration addLayoutClickListener(LayoutClickListener listener) { addListener(EventId.LAYOUT_CLICK_EVENT_IDENTIFIER, LayoutClickEvent.class, listener, LayoutClickListener.clickMethod); + return () -> removeListener(EventId.LAYOUT_CLICK_EVENT_IDENTIFIER, + LayoutClickEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #addLayoutClickListener(LayoutClickListener)} - **/ @Override @Deprecated - public void addListener(LayoutClickListener listener) { - addLayoutClickListener(listener); - } - - @Override public void removeLayoutClickListener(LayoutClickListener listener) { removeListener(EventId.LAYOUT_CLICK_EVENT_IDENTIFIER, LayoutClickEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeLayoutClickListener(LayoutClickListener)} - **/ - @Override - @Deprecated - public void removeListener(LayoutClickListener listener) { - removeLayoutClickListener(listener); - } - /* * (non-Javadoc) * |