Treat the search box oracle as a remote oracle

Most (but not all) search operator oracles are remote oracles.
Wrapping them inside of RemoteSuggestOracle allows the UI to drop
intermediate lookup requests generated when the user is typing faster
than the network or server can process the key events.

Change-Id: I79eaa849c3c194ee89d6bf018112408437092fbf
This commit is contained in:
Shawn Pearce
2014-12-31 16:59:37 -05:00
parent 74660ebc2f
commit 2ace2d14e9

View File

@@ -16,6 +16,7 @@ package com.google.gerrit.client;
import com.google.gerrit.client.changes.QueryScreen;
import com.google.gerrit.client.ui.HintTextBox;
import com.google.gerrit.client.ui.RemoteSuggestOracle;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gwt.event.dom.client.ClickEvent;
@@ -54,8 +55,9 @@ class SearchPanel extends Composite {
}
});
final SuggestBox suggestBox =
new SuggestBox(new SearchSuggestOracle(), searchBox, suggestionDisplay);
final SuggestBox suggestBox = new SuggestBox(
new RemoteSuggestOracle(new SearchSuggestOracle()),
searchBox, suggestionDisplay);
searchBox.setStyleName("gwt-TextBox");
searchBox.setVisibleLength(70);
searchBox.setHintText(Gerrit.C.searchHint());