From 9c88657db52d73f6dd8b976ce0d4cada643b2a4d Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Wed, 26 Oct 2016 16:22:00 +0300 Subject: Implement focus and blur events for CheckBoxGroup. Fixes vaadin/framework8-issues#334 Change-Id: I4c7ca424cc4f4a1f0cdecd7671827465ab74ace7 --- .../src/main/java/com/vaadin/v7/ui/CheckBox.java | 12 ++---------- .../src/main/java/com/vaadin/v7/ui/NativeSelect.java | 19 +++++-------------- 2 files changed, 7 insertions(+), 24 deletions(-) (limited to 'compatibility-server/src') diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/CheckBox.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/CheckBox.java index d3c7b1a50c..a75815d9df 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/CheckBox.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/CheckBox.java @@ -23,7 +23,7 @@ import org.jsoup.nodes.Element; import com.vaadin.event.FieldEvents.BlurEvent; import com.vaadin.event.FieldEvents.BlurListener; -import com.vaadin.event.FieldEvents.FocusAndBlurServerRpcImpl; +import com.vaadin.event.FieldEvents.FocusAndBlurServerRpcDecorator; import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.event.FieldEvents.FocusListener; import com.vaadin.shared.MouseEventDetails; @@ -67,20 +67,12 @@ public class CheckBox extends AbstractField { } }; - FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl( - this) { - @Override - protected void fireEvent(Event event) { - CheckBox.this.fireEvent(event); - } - }; - /** * Creates a new checkbox. */ public CheckBox() { registerRpc(rpc); - registerRpc(focusBlurRpc); + registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent)); setValue(Boolean.FALSE); } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/NativeSelect.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/NativeSelect.java index 3d535f2584..a782956867 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/NativeSelect.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/NativeSelect.java @@ -20,7 +20,7 @@ import java.util.Collection; import com.vaadin.event.FieldEvents.BlurEvent; import com.vaadin.event.FieldEvents.BlurListener; -import com.vaadin.event.FieldEvents.FocusAndBlurServerRpcImpl; +import com.vaadin.event.FieldEvents.FocusAndBlurServerRpcDecorator; import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.event.FieldEvents.FocusListener; import com.vaadin.v7.data.Container; @@ -37,33 +37,24 @@ import com.vaadin.v7.event.FieldEvents; public class NativeSelect extends AbstractSelect implements FieldEvents.BlurNotifier, FieldEvents.FocusNotifier { - FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl( - this) { - - @Override - protected void fireEvent(Event event) { - NativeSelect.this.fireEvent(event); - } - }; - public NativeSelect() { super(); - registerRpc(focusBlurRpc); + registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent)); } public NativeSelect(String caption, Collection options) { super(caption, options); - registerRpc(focusBlurRpc); + registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent)); } public NativeSelect(String caption, Container dataSource) { super(caption, dataSource); - registerRpc(focusBlurRpc); + registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent)); } public NativeSelect(String caption) { super(caption); - registerRpc(focusBlurRpc); + registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent)); } @Override -- cgit v1.2.3