diff options
author | Denis Anisimov <denis@vaadin.com> | 2016-11-28 10:10:21 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-11-29 10:35:59 +0000 |
commit | b8e84da2e2dc4bcaed40d169c40a97f3d11e0648 (patch) | |
tree | 80e5a8e7a7856b67048319958ef88b5466d3e4bc /shared | |
parent | 0d57c15577f5d5e15453024ce90144120948eae9 (diff) | |
download | vaadin-framework-b8e84da2e2dc4bcaed40d169c40a97f3d11e0648.tar.gz vaadin-framework-b8e84da2e2dc4bcaed40d169c40a97f3d11e0648.zip |
Correct all tests that introspect classpath for Vaadin classes.
Fixes vaadin/framework8-issues#399
RemoveListenersDeprecatedTest test is fixed.
Corrections are made to make the test above passes.
Change-Id: I209a4693d241a1488b69b4742f48549dbf4bf0ac
Diffstat (limited to 'shared')
-rw-r--r-- | shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java b/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java index a38b828471..bcc4b3f496 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java +++ b/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java @@ -19,6 +19,7 @@ import java.io.Serializable; import java.util.HashSet; import com.vaadin.shared.AbstractComponentState; +import com.vaadin.shared.Registration; import com.vaadin.shared.communication.SharedState; public final class ComponentStateUtil implements Serializable { @@ -57,7 +58,11 @@ public final class ComponentStateUtil implements Serializable { * * @param eventListenerId * The event identifier to remove + * @deprecated Use a {@link Registration} object returned by + * {@link #addRegisteredEventListener(SharedState, String)} to + * remove a listener */ + @Deprecated public static final void removeRegisteredEventListener(SharedState state, String eventIdentifier) { if (state.registeredEventListeners == null) { @@ -74,12 +79,14 @@ public final class ComponentStateUtil implements Serializable { * * @param eventListenerId * The event identifier to add + * @return a registration object for removing the listener */ - public static final void addRegisteredEventListener(SharedState state, - String eventListenerId) { + public static final Registration addRegisteredEventListener( + SharedState state, String eventListenerId) { if (state.registeredEventListeners == null) { state.registeredEventListeners = new HashSet<>(); } state.registeredEventListeners.add(eventListenerId); + return () -> removeRegisteredEventListener(state, eventListenerId); } } |