summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VComboBox.java39
1 files changed, 27 insertions, 12 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VComboBox.java b/client/src/main/java/com/vaadin/client/ui/VComboBox.java
index f80927ec1d..2575f056b9 100644
--- a/client/src/main/java/com/vaadin/client/ui/VComboBox.java
+++ b/client/src/main/java/com/vaadin/client/ui/VComboBox.java
@@ -16,16 +16,6 @@
package com.vaadin.client.ui;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-import java.util.UUID;
-import java.util.logging.Logger;
-
import com.google.gwt.animation.client.AnimationScheduler;
import com.google.gwt.aria.client.Roles;
import com.google.gwt.core.client.JavaScriptObject;
@@ -85,6 +75,15 @@ import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.ui.ComponentStateUtil;
import com.vaadin.shared.util.SharedUtil;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+import java.util.logging.Logger;
+
/**
* Client side implementation of the ComboBox component.
*
@@ -258,12 +257,12 @@ public class VComboBox extends Composite implements Field, KeyDownHandler,
return $entry(function(e) {
var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX;
var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY;
-
+
// IE8 has only delta y
if (isNaN(deltaY)) {
deltaY = -0.5*e.wheelDelta;
}
-
+
@com.vaadin.client.ui.VComboBox.JsniUtil::moveScrollFromEvent(*)(widget, deltaX, deltaY, e, e.deltaMode);
});
}-*/;
@@ -1636,6 +1635,11 @@ public class VComboBox extends Composite implements Field, KeyDownHandler,
performSelection(selectedKey, oldSuggestionTextMatchTheOldSelection,
!isWaitingForFilteringResponse() || popupOpenerClicked);
+ // currentSuggestion should be set to match the value of the
+ // ComboBox, especially when a new item is added.
+ resetCurrentSuggestionIfNecessary(selectedKey, selectedCaption,
+ selectedIconUri);
+
cancelPendingPostFiltering();
setSelectedCaption(selectedCaption);
@@ -1643,6 +1647,16 @@ public class VComboBox extends Composite implements Field, KeyDownHandler,
setSelectedItemIcon(selectedIconUri);
}
+ private void resetCurrentSuggestionIfNecessary(String selectedKey,
+ String selectedCaption, String selectedIconUri) {
+ if (currentSuggestion == null
+ && (selectedKey != null || selectedCaption != null))
+ currentSuggestion = new ComboBoxSuggestion(selectedKey,
+ selectedCaption, "", selectedIconUri);
+ else if (selectedKey == null && selectedCaption == null)
+ currentSuggestion = null;
+ }
+
}
// TODO decide whether this should change - affects themes and v7
@@ -2110,6 +2124,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler,
currentSuggestion = null; // #13217
selectedOptionKey = null;
setText(getEmptySelectionCaption());
+ return;
}
// some item selected
for (ComboBoxSuggestion suggestion : currentSuggestions) {