diff options
author | Johannes Dahlström <johannes.dahlstrom@vaadin.com> | 2012-02-02 15:30:15 +0000 |
---|---|---|
committer | Johannes Dahlström <johannes.dahlstrom@vaadin.com> | 2012-02-02 15:30:15 +0000 |
commit | 5a8bb1eac00b6f5fe6bf8eea9a86a4016e50d6ed (patch) | |
tree | 736b39806dbe49afbb28840721eeb5b19cf1d922 /src/com | |
parent | 823372bb76040aa7a830c075b4bd49d850f0c83a (diff) | |
download | vaadin-framework-5a8bb1eac00b6f5fe6bf8eea9a86a4016e50d6ed.tar.gz vaadin-framework-5a8bb1eac00b6f5fe6bf8eea9a86a4016e50d6ed.zip |
Fixed #8321: adding/removing items in a ComboBox FocusListener breaks the dropdown list.
Clicking the dropdown button on an unfocused ComboBox would send a separate options request and a focus event request. The responses would confuse the rendering logic. The changes are now sent in a single variable burst.
svn changeset:22863/svn branch:6.7
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java index 9a6cbdcd9b..e261286cb7 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java @@ -1013,6 +1013,20 @@ public class VFilterSelect extends Composite implements Paintable, Field, * The filter to apply to the components */ public void filterOptions(int page, String filter) { + filterOptions(page, filter, true); + } + + /** + * Filters the options at certain page using the given filter + * + * @param page + * The page to filter + * @param filter + * The filter to apply to the options + * @param immediate + * Whether to send the options request immediately + */ + private void filterOptions(int page, String filter, boolean immediate) { if (filter.equals(lastFilter) && currentPage == page) { if (!suggestionPopup.isAttached()) { suggestionPopup.showSuggestions(currentSuggestions, @@ -1032,7 +1046,7 @@ public class VFilterSelect extends Composite implements Paintable, Field, waitingForFilteringResponse = true; client.updateVariable(paintableId, "filter", filter, false); - client.updateVariable(paintableId, "page", page, true); + client.updateVariable(paintableId, "page", page, immediate); lastFilter = filter; currentPage = page; } @@ -1622,7 +1636,12 @@ public class VFilterSelect extends Composite implements Paintable, Field, // ask suggestionPopup if it was just closed, we are using GWT // Popup's auto close feature if (!suggestionPopup.isJustClosed()) { - filterOptions(-1, ""); + // If a focus event is not going to be sent, send the options + // request immediately; otherwise queue in the same burst as the + // focus event. Fixes #8321. + boolean immediate = focused + || !client.hasEventListeners(this, EventId.FOCUS); + filterOptions(-1, "", immediate); popupOpenerClicked = true; lastFilter = ""; } |