Search in sources :

Example 6 with SuggestBox

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

Example 7 with SuggestBox

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);
    }
}
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)7 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)3 CheckBox (com.google.gwt.user.client.ui.CheckBox)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)2 JsArrayString (com.google.gwt.core.client.JsArrayString)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 ResizeEvent (com.google.gwt.event.logical.shared.ResizeEvent)1 ResizeHandler (com.google.gwt.event.logical.shared.ResizeHandler)1 Timer (com.google.gwt.user.client.Timer)1 Button (com.google.gwt.user.client.ui.Button)1 HTML (com.google.gwt.user.client.ui.HTML)1 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)1 Label (com.google.gwt.user.client.ui.Label)1 ListBox (com.google.gwt.user.client.ui.ListBox)1 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)1 DefaultSuggestionDisplay (com.google.gwt.user.client.ui.SuggestBox.DefaultSuggestionDisplay)1 TextBox (com.google.gwt.user.client.ui.TextBox)1 TextBoxBase (com.google.gwt.user.client.ui.TextBoxBase)1