diff options
author | Leif Åstrand <leif@vaadin.com> | 2016-11-23 09:52:07 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2016-11-23 09:52:07 +0200 |
commit | 68ea8ea63d9ba04f166f0a5897516c586c696e50 (patch) | |
tree | 31c99d3ee27d810e80e6365c32c47a0525b38918 /server/src/main/java/com/vaadin/ui/TabSheet.java | |
parent | b9a107c2f7a8227c12a6df6a29c9abaf292863c9 (diff) | |
download | vaadin-framework-68ea8ea63d9ba04f166f0a5897516c586c696e50.tar.gz vaadin-framework-68ea8ea63d9ba04f166f0a5897516c586c696e50.zip |
Refactor listener registration creation to reduce boilerplate
Change-Id: I9feaad000cb16351d281d1c0037330dfb76186ff
Diffstat (limited to 'server/src/main/java/com/vaadin/ui/TabSheet.java')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/TabSheet.java | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/server/src/main/java/com/vaadin/ui/TabSheet.java b/server/src/main/java/com/vaadin/ui/TabSheet.java index 7ad40c2771..396c4975c1 100644 --- a/server/src/main/java/com/vaadin/ui/TabSheet.java +++ b/server/src/main/java/com/vaadin/ui/TabSheet.java @@ -831,9 +831,7 @@ public class TabSheet extends AbstractComponentContainer */ public Registration addSelectedTabChangeListener( SelectedTabChangeListener listener) { - addListener(SelectedTabChangeEvent.class, listener, - SELECTED_TAB_CHANGE_METHOD); - return () -> removeListener(SelectedTabChangeEvent.class, listener, + return addListener(SelectedTabChangeEvent.class, listener, SELECTED_TAB_CHANGE_METHOD); } @@ -1366,10 +1364,8 @@ public class TabSheet extends AbstractComponentContainer @Override public Registration addBlurListener(BlurListener listener) { - addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener, + return addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener, BlurListener.blurMethod); - return () -> removeListener(BlurEvent.EVENT_ID, BlurEvent.class, - listener); } @Override @@ -1380,10 +1376,8 @@ public class TabSheet extends AbstractComponentContainer @Override public Registration addFocusListener(FocusListener listener) { - addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener, + return addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener, FocusListener.focusMethod); - return () -> removeListener(FocusEvent.EVENT_ID, FocusEvent.class, - listener); } @Override |