use of com.google.gwt.user.client.ui.SuggestBox in project opentsdb by OpenTSDB.
the class RemoteOracle method newSuggestBox.
/**
* Factory method to use in order to get a {@link RemoteOracle} instance.
* @param suggest_type The type of suggestion wanted.
* @param textbox The text box to wrap to provide suggestions to.
*/
public static SuggestBox newSuggestBox(final String suggest_type, final TextBoxBase textbox) {
final RemoteOracle oracle = new RemoteOracle(suggest_type);
final SuggestBox box = new SuggestBox(oracle, textbox);
oracle.requester = box;
return box;
}
use of com.google.gwt.user.client.ui.SuggestBox in project gerrit by GerritCodeReview.
the class HintTextBox method onKey.
private void onKey(int key) {
if (key == KeyCodes.KEY_ESCAPE) {
setText(prevText);
Widget p = getParent();
if (p instanceof SuggestBox) {
// Since the text was changed, ensure that the SuggestBox is
// aware of this change so that it will refresh properly on
// the next keystroke. Without this, if the first keystroke
// recreates the same string as before ESC was pressed, the
// SuggestBox will think that the string has not changed, and
// it will not yet provide any Suggestions.
((SuggestBox) p).showSuggestionList();
// The suggestion list lingers if we don't hide it.
((DefaultSuggestionDisplay) ((SuggestBox) p).getSuggestionDisplay()).hideSuggestions();
}
setFocus(false);
}
}
Aggregations