Home » GWT SuggestBox

GWT SuggestBox

GWT SuggestBox is a text box or text area which displays a pre-configured set of selections that match the user’s input. Each SuggestBox is associated with a single SuggestOracle. The SuggestOracle is used to provide a set of selections given a specific query string.

GWT SuggestBox Syntax

GWT SuggestBox Nested Classes

Class Description
SuggestBox.DefaultSuggestionDisplay It is the default implementation of SuggestBox.SuggestionDisplay displays suggestions in a PopupPanel beneath the SuggestBox.
SuggestBox.SuggestionCallback It is the callback used when a user selects a SuggestOracle.Suggestion.
It is the callback used when a user selects a SuggestOracle.Suggestion. It is used to display suggestions to the user.

GWT SuggestBox Constructors

Constructor Description
SuggestBox() It is a default constructor for SuggestBox.
SuggestBox(SuggestOracle oracle) It is a constructor for SuggestBox.
SuggestBox(SuggestOracle oracle, ValueBoxBase<java.lang.String> box) It extends suggest oracle and value box.
SuggestBox(SuggestOracle oracle, ValueBoxBase<java.lang.String> box, SuggestBox.SuggestionDisplay suggestDisplay) It display SuggestOracle and ValueBox in a single SuggestBox.

GWT SuggestBox Common Methods

Modifier and types Methods Description
void addChangeListener(ChangeListener listener) It gets a text box.
void addClickListener(ClickListener listener) It gets a input on click.
void addEventHandler(SuggestionHandler handler) It adds a event handler.
void addFocusListener(FocusListener listener) It can add blur or focus to particular area.
void addKeyboardListener(KeyboardListener listener) It takes input through keyboard.
HandlerRegistration addKeyDownHandler(KeyDownHandler handler) It adds a KeyDownEvent handler.
HandlerRegistration addKeyPressHandler(KeyPressHandler handler) It adds a KeyPressEvent handler.
HandlerRegistration addKeyUpHandler(KeyUpHandler handler) It adds a KeyUpEvent handler.
HandlerRegistration addSelectionHandler(SelectionHandler<SuggestOracle.Suggestion> handler) It adds a SelectionEvent handler.
HandlerRegistration addValueChangeHandler(ValueChangeHandler<java.lang.String> handler) It adds a ValueChangeEvent handler.
boolean isAnimationEnabled() It displays animation.
boolean isAutoSelectEnabled() It returns whether or not the first suggestion will be automatically selected.
boolean isEnabled() It gets whether this widget is enabled.
boolean isSuggestionListShowing() It checks if the SuggestBox.SuggestionDisplay is showing.
protected void onEnsureDebugId(java.lang.String baseID) It is called when the user sets the id using the UIObject.ensureDebugId(String) method.

GWT SuggestBox Example

Output:

GWT SuggestBox 1

Next TopicGWT Layout Panels

You may also like