summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorTomi Virtanen <tltv@vaadin.com>2013-11-27 15:10:41 +0200
committerVaadin Code Review <review@vaadin.com>2014-01-09 09:48:49 +0000
commitc5515074b54f37c21d021ab910d2749a9a1bc24d (patch)
treea67895d7a724eedace892955cf61c2928cfd32fa /client
parentfbc48c6ab75479560919a463ba5693b44bb0e811 (diff)
downloadvaadin-framework-c5515074b54f37c21d021ab910d2749a9a1bc24d.tar.gz
vaadin-framework-c5515074b54f37c21d021ab910d2749a9a1bc24d.zip
Selected option is updated when item caption changes in Select (#9250)
Fixed ComboBoxConnector to update input-element text to match the changed item caption. Added SelectItemCaptionRefresh test case and TestBench2 (html) test for it. Change-Id: I45b2168aab27f83203a59500715ac9aca5357412
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java35
1 files changed, 16 insertions, 19 deletions
diff --git a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
index f91ff9e2b9..24597d1d8c 100644
--- a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
+++ b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
@@ -212,26 +212,23 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
// some item selected
for (FilterSelectSuggestion suggestion : getWidget().currentSuggestions) {
String suggestionKey = suggestion.getOptionKey();
- if (suggestionKey.equals(selectedKey)) {
- if (!getWidget().waitingForFilteringResponse
- || getWidget().popupOpenerClicked) {
- if (!suggestionKey.equals(getWidget().selectedOptionKey)
- || suggestion.getReplacementString().equals(
- getWidget().tb.getText())) {
- // Update text field if we've got a new
- // selection
- // Also update if we've got the same text to
- // retain old text selection behavior
- getWidget().setPromptingOff(
- suggestion.getReplacementString());
- getWidget().selectedOptionKey = suggestionKey;
- }
- }
- getWidget().currentSuggestion = suggestion;
- getWidget().setSelectedItemIcon(suggestion.getIconUri());
- // only a single item can be selected
- break;
+ if (!suggestionKey.equals(selectedKey)) {
+ continue;
+ }
+ if (!getWidget().waitingForFilteringResponse
+ || getWidget().popupOpenerClicked) {
+ // Update text field if we've got a new
+ // selection
+ // Also update if we've got the same text to
+ // retain old text selection behavior
+ // OR if selected item caption is changed.
+ getWidget().setPromptingOff(suggestion.getReplacementString());
+ getWidget().selectedOptionKey = suggestionKey;
}
+ getWidget().currentSuggestion = suggestion;
+ getWidget().setSelectedItemIcon(suggestion.getIconUri());
+ // only a single item can be selected
+ break;
}
}