diff options
author | Aleksi Hietanen <aleksi@vaadin.com> | 2017-11-21 14:25:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-21 14:25:42 +0200 |
commit | f805482c6013cebdb401341da37614fd664f85c7 (patch) | |
tree | d5f04537f28513a4fbab86e2655eaa4e7a05b444 /shared/src | |
parent | 0fbeb0a6261b5a9f6485928965f0932fea0e624f (diff) | |
download | vaadin-framework-f805482c6013cebdb401341da37614fd664f85c7.tar.gz vaadin-framework-f805482c6013cebdb401341da37614fd664f85c7.zip |
Fix issues from API review for 8.2 (#10342)
* Rename HierarchicalDataCommunicator#getMapper to getHierarchyMapper
* Make rpc field in Notification private
* Change DropIndexCalculator.ALWAYS_DROP_TO_END to a generic static method
* Move EditorImpl#editRow documentation to the interface level
* Correct GridDragEndEvent, GridDragStartEvent constructor javadocs
* Revert SharedState.registeredEventListeners to a Set
* Rename GridDropTarget dropAllowedOnSortedGridRows
* Rename ColumnState.contentMode to tooltipContentMode
Diffstat (limited to 'shared/src')
3 files changed, 13 insertions, 26 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/communication/SharedState.java b/shared/src/main/java/com/vaadin/shared/communication/SharedState.java index 872327e8fd..fd9a3ce0bd 100644 --- a/shared/src/main/java/com/vaadin/shared/communication/SharedState.java +++ b/shared/src/main/java/com/vaadin/shared/communication/SharedState.java @@ -19,6 +19,7 @@ package com.vaadin.shared.communication; import java.io.Serializable; import java.util.HashMap; import java.util.Map; +import java.util.Set; import com.vaadin.shared.Connector; import com.vaadin.shared.annotations.NoLayout; @@ -63,12 +64,9 @@ public class SharedState implements Serializable { public boolean enabled = true; /** - * A Map of event identifiers with registered listeners, {@code key} is - * event identifier, {@code value} is the listeners count. - * - * @since 8.2 + * A set of event identifiers with registered listeners. */ @NoLayout - public Map<String, Integer> registeredEventListeners; + public Set<String> registeredEventListeners; } 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 a2f6618b9e..0ef247353b 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java +++ b/shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java @@ -16,7 +16,7 @@ package com.vaadin.shared.ui; import java.io.Serializable; -import java.util.HashMap; +import java.util.HashSet; import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.Registration; @@ -67,19 +67,12 @@ public final class ComponentStateUtil implements Serializable { @Deprecated public static final void removeRegisteredEventListener(SharedState state, String eventIdentifier) { - if (state.registeredEventListeners != null) { - Integer count = state.registeredEventListeners.get(eventIdentifier); - if (count != null) { - if (count > 1) { - state.registeredEventListeners.put(eventIdentifier, - count - 1); - } else { - state.registeredEventListeners.remove(eventIdentifier); - if (state.registeredEventListeners.isEmpty()) { - state.registeredEventListeners = null; - } - } - } + if (state.registeredEventListeners == null) { + return; + } + state.registeredEventListeners.remove(eventIdentifier); + if (state.registeredEventListeners.size() == 0) { + state.registeredEventListeners = null; } } @@ -94,13 +87,9 @@ public final class ComponentStateUtil implements Serializable { public static final Registration addRegisteredEventListener( SharedState state, String eventListenerId) { if (state.registeredEventListeners == null) { - state.registeredEventListeners = new HashMap<>(); - } - Integer count = state.registeredEventListeners.get(eventListenerId); - if (count == null) { - count = 0; + state.registeredEventListeners = new HashSet<>(); } - state.registeredEventListeners.put(eventListenerId, count + 1); + state.registeredEventListeners.add(eventListenerId); return () -> removeRegisteredEventListener(state, eventListenerId); } } diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/ColumnState.java b/shared/src/main/java/com/vaadin/shared/ui/grid/ColumnState.java index eb0e28dce9..652db0c1bf 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/grid/ColumnState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/grid/ColumnState.java @@ -80,6 +80,6 @@ public class ColumnState extends AbstractGridExtensionState { * * @since 8.2 */ - public ContentMode contentMode; + public ContentMode tooltipContentMode; } |