aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcaalador <mikael.grankvist@gmail.com>2017-02-09 10:18:41 +0200
committerHenri Sara <henri.sara@gmail.com>2017-02-09 10:18:41 +0200
commit79a33ef679f78169fb303c36bfefee6ce01cf58d (patch)
treed0a129e267b4f924bb417f201a98d6647b6fed1e
parentf5f42ae2436c46413f3080a6e0644b7b40c5f73f (diff)
downloadvaadin-framework-79a33ef679f78169fb303c36bfefee6ce01cf58d.tar.gz
vaadin-framework-79a33ef679f78169fb303c36bfefee6ce01cf58d.zip
Fix click selection for automatic testing. (#8513)
Don't implement handlers on widget level.
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VListSelect.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VListSelect.java b/client/src/main/java/com/vaadin/client/ui/VListSelect.java
index 68d25bbe30..9ce897de0e 100644
--- a/client/src/main/java/com/vaadin/client/ui/VListSelect.java
+++ b/client/src/main/java/com/vaadin/client/ui/VListSelect.java
@@ -22,13 +22,10 @@ import java.util.Objects;
import java.util.Set;
import java.util.function.BiConsumer;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HasEnabled;
import com.google.gwt.user.client.ui.ListBox;
-
import com.vaadin.client.FastStringSet;
import com.vaadin.client.Focusable;
import com.vaadin.client.connectors.AbstractMultiSelectConnector.MultiSelectWidget;
@@ -41,8 +38,8 @@ import elemental.json.JsonObject;
*
* @author Vaadin Ltd
*/
-public class VListSelect extends Composite implements ChangeHandler, Field,
- Focusable, HasEnabled, MultiSelectWidget {
+public class VListSelect extends Composite
+ implements Field, Focusable, HasEnabled, MultiSelectWidget {
private List<BiConsumer<Set<String>, Set<String>>> selectionChangeListeners = new ArrayList<>();
@@ -64,7 +61,12 @@ public class VListSelect extends Composite implements ChangeHandler, Field,
select = new ListBox();
select.setMultipleSelect(true);
- select.addChangeHandler(this);
+
+ // Add event handlers
+ select.addClickHandler(
+ clickEvent -> selectionEvent(clickEvent.getSource()));
+ select.addChangeHandler(
+ changeEvent -> selectionEvent(changeEvent.getSource()));
container.add(select);
@@ -161,9 +163,8 @@ public class VListSelect extends Composite implements ChangeHandler, Field,
return selectedItemKeys;
}
- @Override
- public void onChange(ChangeEvent changeEvent) {
- if (changeEvent.getSource() == select) {
+ private void selectionEvent(Object source){
+ if (source == select) {
// selection can change by adding and at the same time removing
// previous keys, or by just adding (e.g. when modifier keys are
// pressed)