From 5778c65bdef65337f8cbcc9d0504abbd11f8278f Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 7 Dec 2016 13:27:43 +0200 Subject: Don't use V8 FieldEvents classes in v7 compatibility module. (#93) * Don't use V8 FieldEvents classes in v7 compatibility module. Fixes vaadin/framework8-issues#363 --- .../tests/components/AbstractComponentTest.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'uitest') diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java index 6fbb489c1f..7089a2e810 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java @@ -249,25 +249,31 @@ public abstract class AbstractComponentTest extends protected Command focusListenerCommand = new Command() { + private Registration focusListenerRegistration; + @Override public void execute(T c, Boolean value, Object data) { - FocusNotifier fn = (FocusNotifier) c; + FocusNotifier focusNotifier = (FocusNotifier) c; if (value) { - fn.addFocusListener(AbstractComponentTest.this); - } else { - fn.removeFocusListener(AbstractComponentTest.this); + focusListenerRegistration = focusNotifier + .addFocusListener(AbstractComponentTest.this); + } else if (focusListenerRegistration != null) { + focusListenerRegistration.remove(); } } }; protected Command blurListenerCommand = new Command() { + private Registration blurListenerRegistration; + @Override public void execute(T c, Boolean value, Object data) { BlurNotifier bn = (BlurNotifier) c; if (value) { - bn.addBlurListener(AbstractComponentTest.this); - } else { - bn.removeBlurListener(AbstractComponentTest.this); + blurListenerRegistration = bn + .addBlurListener(AbstractComponentTest.this); + } else if (blurListenerRegistration != null) { + blurListenerRegistration.remove(); } } }; -- cgit v1.2.3