Search in sources :

Example 1 with DefaultSuggestionDisplay

use of com.google.gwt.user.client.ui.SuggestBox.DefaultSuggestionDisplay 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);
    }
}
Also used : SuggestBox(com.google.gwt.user.client.ui.SuggestBox) Widget(com.google.gwt.user.client.ui.Widget) DefaultSuggestionDisplay(com.google.gwt.user.client.ui.SuggestBox.DefaultSuggestionDisplay)

Aggregations

SuggestBox (com.google.gwt.user.client.ui.SuggestBox)1 DefaultSuggestionDisplay (com.google.gwt.user.client.ui.SuggestBox.DefaultSuggestionDisplay)1 Widget (com.google.gwt.user.client.ui.Widget)1