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/AbstractSplitPanel.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/AbstractSplitPanel.java')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java b/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java index 3add13cd4a..5f481cb537 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java +++ b/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java @@ -29,6 +29,7 @@ import com.vaadin.server.SizeWithUnit; import com.vaadin.server.Sizeable; import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.Registration; import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelRpc; import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelState; import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelState.SplitterState; @@ -575,45 +576,32 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { } - public void addSplitterClickListener(SplitterClickListener listener) { + public Registration addSplitterClickListener( + SplitterClickListener listener) { addListener(EventId.CLICK_EVENT_IDENTIFIER, SplitterClickEvent.class, listener, SplitterClickListener.clickMethod); + return () -> removeListener(EventId.CLICK_EVENT_IDENTIFIER, + SplitterClickEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #addSplitterClickListener(SplitterClickListener)} - **/ @Deprecated - public void addListener(SplitterClickListener listener) { - addSplitterClickListener(listener); - } - public void removeSplitterClickListener(SplitterClickListener listener) { removeListener(EventId.CLICK_EVENT_IDENTIFIER, SplitterClickEvent.class, listener); } /** - * @deprecated As of 7.0, replaced by - * {@link #removeSplitterClickListener(SplitterClickListener)} - **/ - @Deprecated - public void removeListener(SplitterClickListener listener) { - removeSplitterClickListener(listener); - } - - /** * Register a listener to handle {@link SplitPositionChangeEvent}s. * * @since 7.5.0 * @param listener * {@link SplitPositionChangeListener} to be registered. */ - public void addSplitPositionChangeListener( + public Registration addSplitPositionChangeListener( SplitPositionChangeListener listener) { addListener(SplitPositionChangeEvent.class, listener, SplitPositionChangeListener.moveMethod); + return () -> removeListener(SplitPositionChangeEvent.class, listener); } /** @@ -623,6 +611,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * @param listener * SplitPositionChangeListener to be removed. */ + @Deprecated public void removeSplitPositionChangeListener( SplitPositionChangeListener listener) { removeListener(SplitPositionChangeEvent.class, listener); |