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/AbstractSplitPanel.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/AbstractSplitPanel.java')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java b/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java index e7a66cebe5..8fe762f2a9 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java +++ b/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java @@ -578,10 +578,9 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { public Registration addSplitterClickListener( SplitterClickListener listener) { - addListener(EventId.CLICK_EVENT_IDENTIFIER, SplitterClickEvent.class, - listener, SplitterClickListener.clickMethod); - return () -> removeListener(EventId.CLICK_EVENT_IDENTIFIER, - SplitterClickEvent.class, listener); + return addListener(EventId.CLICK_EVENT_IDENTIFIER, + SplitterClickEvent.class, listener, + SplitterClickListener.clickMethod); } @Deprecated @@ -599,9 +598,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { */ public Registration addSplitPositionChangeListener( SplitPositionChangeListener listener) { - addListener(SplitPositionChangeEvent.class, listener, + return addListener(SplitPositionChangeEvent.class, listener, SplitPositionChangeListener.moveMethod); - return () -> removeListener(SplitPositionChangeEvent.class, listener); } /** @@ -707,8 +705,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { super.writeDesign(design, designContext); // handle custom attributes (write only if a value is not the // default value) - AbstractSplitPanel def = designContext - .getDefaultInstance(this); + AbstractSplitPanel def = designContext.getDefaultInstance(this); if (getSplitPosition() != def.getSplitPosition() || !def.getSplitPositionUnit().equals(getSplitPositionUnit())) { String splitPositionString = asString(getSplitPosition()) |