Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.user.client.ui
Class SuggestBox

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.google.gwt.user.client.ui.Composite
                  com.google.gwt.user.client.ui.SuggestBox

All Implemented Interfaces:
  IsEditor<LeafValueEditor<java.lang.String>>, HasAllKeyHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasAttachHandlers, HasSelectionHandlers<SuggestOracle.Suggestion>, HasValueChangeHandlers<java.lang.String>, HasHandlers, EventListener, TakesValue<java.lang.String>, FiresSuggestionEvents, Focusable, HasAnimation, HasEnabled, HasFocus, HasText, HasValue<java.lang.String>, HasVisibility, IsRenderable, IsWidget, SourcesChangeEvents, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents

    public class SuggestBox

extends Composite
implements HasText, HasFocus, HasAnimation, HasEnabled, SourcesClickEvents, SourcesChangeEvents, SourcesKeyboardEvents, FiresSuggestionEvents, HasAllKeyHandlers, HasValue<java.lang.String>, HasSelectionHandlers<SuggestOracle.Suggestion>, IsEditor<LeafValueEditor<java.lang.String>>

A `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.

By default, the `SuggestBox` uses a `MultiWordSuggestOracle` as its oracle. Below we show how a `MultiWordSuggestOracle` can be configured:

       MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
       oracle.add("Cat");
       oracle.add("Dog");
       oracle.add("Horse");
       oracle.add("Canary");

       SuggestBox box = new SuggestBox(oracle);

Using the example above, if the user types "C" into the text widget, the oracle will configure the suggestions with the "Cat" and "Canary" suggestions. Specifically, whenever the user types a key into the text widget, the value is submitted to the `MultiWordSuggestOracle`.

Note that there is no method to retrieve the "currently selected suggestion" in a SuggestBox, because there are points in time where the currently selected suggestion is not defined. For example, if the user types in some text that does not match any of the SuggestBox's suggestions, then the SuggestBox will not have a currently selected suggestion. It is more useful to know when a suggestion has been chosen from the SuggestBox's list of suggestions. A SuggestBox fires `SelectionEvents` whenever a suggestion is chosen, and handlers for these events can be added using the `addSelectionHandler(SelectionHandler)` method.

### CSS Style Rules

.gwt-SuggestBox
  the suggest box itself

See Also:
  `SuggestOracle`, `MultiWordSuggestOracle`, `ValueBoxBase`

Nested Class Summary
`static class` | `SuggestBox.DefaultSuggestionDisplay` The default implementation of `SuggestBox.SuggestionDisplay` displays suggestions in a `PopupPanel` beneath the `SuggestBox`.
`static interface` | `SuggestBox.SuggestionCallback` The callback used when a user selects a `SuggestOracle.Suggestion`.
`static class` | `SuggestBox.SuggestionDisplay` Used to display suggestions to the user.

Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
`UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

Field Summary

Fields inherited from class com.google.gwt.user.client.ui.Widget
`eventsToSink`

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR`

Constructor Summary
`SuggestBox()` Constructor for `SuggestBox`.
`SuggestBox(SuggestOracle oracle)` Constructor for `SuggestBox`.
`SuggestBox(SuggestOracle oracle, ValueBoxBase<java.lang.String> box)` Constructor for `SuggestBox`.
`SuggestBox(SuggestOracle oracle, ValueBoxBase<java.lang.String> box, SuggestBox.SuggestionDisplay suggestDisplay)` Constructor for `SuggestBox`.

Method Summary
`void` | `addChangeListener(ChangeListener listener)` Deprecated. use `getTextBox()`().addChangeHandler instead
`void` | `addClickListener(ClickListener listener)` Deprecated. use `getTextBox()`().addClickHandler instead
`void` | `addEventHandler(SuggestionHandler handler)` Deprecated. use `addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler)` instead.
`void` | `addFocusListener(FocusListener listener)` Deprecated. use `getTextBox()`().addFocusHandler/addBlurHandler() instead
`void` | `addKeyboardListener(KeyboardListener listener)` Deprecated. Use `addKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler)`, `addKeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler)` and `addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler)` instead
`HandlerRegistration` | `addKeyDownHandler(KeyDownHandler handler)` Adds a `KeyDownEvent` handler.
`HandlerRegistration` | `addKeyPressHandler(KeyPressHandler handler)` Adds a `KeyPressEvent` handler.
`HandlerRegistration` | `addKeyUpHandler(KeyUpHandler handler)` Adds a `KeyUpEvent` handler.
`HandlerRegistration` | `addSelectionHandler(SelectionHandler<SuggestOracle.Suggestion> handler)` Adds a `SelectionEvent` handler.
`HandlerRegistration` | `addValueChangeHandler(ValueChangeHandler<java.lang.String> handler)` Adds a `ValueChangeEvent` handler.
`LeafValueEditor<java.lang.String>` | `asEditor()` Returns a `TakesValueEditor` backed by the SuggestBox.
`int` | `getLimit()` Gets the limit for the number of suggestions that should be displayed for this box.
`SuggestBox.SuggestionDisplay` | `getSuggestionDisplay()` Get the `SuggestBox.SuggestionDisplay` used to display suggestions.
`SuggestOracle` | `getSuggestOracle()` Gets the suggest box's `SuggestOracle`.
`int` | `getTabIndex()` Gets the widget's position in the tab index.
`java.lang.String` | `getText()` Gets this object's text.
`TextBoxBase` | `getTextBox()` Deprecated. in favour of getValueBox
`java.lang.String` | `getValue()` Gets this object's value.
`ValueBoxBase<java.lang.String>` | `getValueBox()` Get the ValueBoxBase associated with this suggest box.
`void` | `hideSuggestionList()` Deprecated. use `SuggestBox.DefaultSuggestionDisplay.hideSuggestions()` instead
`boolean` | `isAnimationEnabled()` Deprecated. use `SuggestBox.DefaultSuggestionDisplay.isAnimationEnabled()` instead
`boolean` | `isAutoSelectEnabled()` Returns whether or not the first suggestion will be automatically selected.
`boolean` | `isEnabled()` Gets whether this widget is enabled.
`boolean` | `isSuggestionListShowing()` Deprecated. use `SuggestBox.DefaultSuggestionDisplay.isSuggestionListShowing()`
`protected void` | `onEnsureDebugId(java.lang.String baseID)` Called when the user sets the id using the `UIObject.ensureDebugId(String)` method.
`void` | `refreshSuggestionList()` Refreshes the current list of suggestions.
`void` | `removeChangeListener(ChangeListener listener)` Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `getTextBox()`().addChangeHandler instead
`void` | `removeClickListener(ClickListener listener)` Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `getTextBox()`().addClickHandler instead
`void` | `removeEventHandler(SuggestionHandler handler)` Deprecated. Use the `HandlerRegistration.removeHandler()` method no the object returned by `addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler)` instead
`void` | `removeFocusListener(FocusListener listener)` Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `getTextBox()`().addFocusListener instead
`void` | `removeKeyboardListener(KeyboardListener listener)` Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `getTextBox()`().add*Handler instead
`void` | `setAccessKey(char key)` Sets the widget's 'access key'.
`void` | `setAnimationEnabled(boolean enable)` Deprecated. use `SuggestBox.DefaultSuggestionDisplay.setAnimationEnabled(boolean)` instead
`void` | `setAutoSelectEnabled(boolean selectsFirstItem)` Turns on or off the behavior that automatically selects the first suggested item.
`void` | `setEnabled(boolean enabled)` Sets whether this widget is enabled.
`void` | `setFocus(boolean focused)` Explicitly focus/unfocus this widget.
`void` | `setLimit(int limit)` Sets the limit to the number of suggestions the oracle should provide.
`void` | `setPopupStyleName(java.lang.String style)` Deprecated. use `SuggestBox.DefaultSuggestionDisplay.setPopupStyleName(String)` instead
`void` | `setTabIndex(int index)` Sets the widget's position in the tab index.
`void` | `setText(java.lang.String text)` Sets this object's text.
`void` | `setValue(java.lang.String newValue)` Sets this object's value without firing any events.
`void` | `setValue(java.lang.String value, boolean fireEvents)` Sets this object's value.
`void` | `showSuggestionList()` Show the current list of suggestions.
`(package private) void` | `showSuggestions(java.lang.String query)`
`static SuggestBox` | `wrap(SuggestOracle oracle, Element element)` Creates a `SuggestBox` widget that wraps an existing <input type='text'> element.

Methods inherited from class com.google.gwt.user.client.ui.Composite
`claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents`

Methods inherited from class com.google.gwt.user.client.ui.UIObject
`addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.google.gwt.event.shared.HasHandlers
`fireEvent`

Constructor Detail

### SuggestBox

    public SuggestBox()

  Constructor for `SuggestBox`. Creates a `MultiWordSuggestOracle` and `TextBox` to use with this `SuggestBox`.

### SuggestBox

    public SuggestBox(SuggestOracle oracle)

  Constructor for `SuggestBox`. Creates a `TextBox` to use with this `SuggestBox`.

  Parameters:
    `oracle` - the oracle for this `SuggestBox`

### SuggestBox

    public SuggestBox(SuggestOracle oracle,
                      ValueBoxBase<java.lang.String> box)

  Constructor for `SuggestBox`. The text box will be removed from it's current location and wrapped by the `SuggestBox`.

  Parameters:
    `oracle` - supplies suggestions based upon the current contents of the text widget
    `box` - the text widget

### SuggestBox

    public SuggestBox(SuggestOracle oracle,
                      ValueBoxBase<java.lang.String> box,
                      SuggestBox.SuggestionDisplay suggestDisplay)

  Constructor for `SuggestBox`. The text box will be removed from it's current location and wrapped by the `SuggestBox`.

  Parameters:
    `oracle` - supplies suggestions based upon the current contents of the text widget
    `box` - the text widget
    `suggestDisplay` - the class used to display suggestions

Method Detail

### wrap

    public static SuggestBox wrap(SuggestOracle oracle,
                                  Element element)

  Creates a `SuggestBox` widget that wraps an existing <input type='text'> element. This element must already be attached to the document. If the element is removed from the document, you must call `RootPanel.detachNow(Widget)`.

  Parameters:
    `oracle` - the suggest box oracle to use
    `element` - the element to be wrapped

### addChangeListener

    @Deprecated
    public void addChangeListener(ChangeListener listener)

  Deprecated. use `getTextBox()`().addChangeHandler instead

  Adds a listener to receive change events on the SuggestBox's text box. The source Widget for these events will be the SuggestBox.

  Specified by:
    `addChangeListener` in interface `SourcesChangeEvents`
  Parameters:
    `listener` - the listener interface to add

### addClickListener

    @Deprecated
    public void addClickListener(ClickListener listener)

  Deprecated. use `getTextBox()`().addClickHandler instead

  Adds a listener to receive click events on the SuggestBox's text box. The source Widget for these events will be the SuggestBox.

  Specified by:
    `addClickListener` in interface `SourcesClickEvents`
  Parameters:
    `listener` - the listener interface to add

### addEventHandler

    @Deprecated
    public void addEventHandler(SuggestionHandler handler)

  Deprecated. use `addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler)` instead.

  Adds an event to this handler.

  Specified by:
    `addEventHandler` in interface `FiresSuggestionEvents`
  Parameters:
    `handler` - the handler to add

### addFocusListener

    @Deprecated
    public void addFocusListener(FocusListener listener)

  Deprecated. use `getTextBox()`().addFocusHandler/addBlurHandler() instead

  Adds a listener to receive focus events on the SuggestBox's text box. The source Widget for these events will be the SuggestBox.

  Specified by:
    `addFocusListener` in interface `SourcesFocusEvents`
  Parameters:
    `listener` - the listener interface to add

### addKeyboardListener

    @Deprecated
    public void addKeyboardListener(KeyboardListener listener)

  Deprecated. Use `addKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler)`, `addKeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler)` and `addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler)` instead

  Description copied from interface: `SourcesKeyboardEvents`
  Adds a listener interface to receive keyboard events.

  Specified by:
    `addKeyboardListener` in interface `SourcesKeyboardEvents`
  Parameters:
    `listener` - the listener interface to add

### addKeyDownHandler

    public HandlerRegistration addKeyDownHandler(KeyDownHandler handler)

  Description copied from interface: `HasKeyDownHandlers`
  Adds a `KeyDownEvent` handler.

  Specified by:
    `addKeyDownHandler` in interface `HasKeyDownHandlers`
  Parameters:
    `handler` - the key down handler
  Returns:
    `HandlerRegistration` used to remove this handler

### addKeyPressHandler

    public HandlerRegistration addKeyPressHandler(KeyPressHandler handler)

  Description copied from interface: `HasKeyPressHandlers`
  Adds a `KeyPressEvent` handler.

  Specified by:
    `addKeyPressHandler` in interface `HasKeyPressHandlers`
  Parameters:
    `handler` - the key press handler
  Returns:
    `HandlerRegistration` used to remove this handler

### addKeyUpHandler

    public HandlerRegistration addKeyUpHandler(KeyUpHandler handler)

  Description copied from interface: `HasKeyUpHandlers`
  Adds a `KeyUpEvent` handler.

  Specified by:
    `addKeyUpHandler` in interface `HasKeyUpHandlers`
  Parameters:
    `handler` - the key up handler
  Returns:
    `HandlerRegistration` used to remove this handler

### addSelectionHandler

    public HandlerRegistration addSelectionHandler(SelectionHandler<SuggestOracle.Suggestion> handler)

  Description copied from interface: `HasSelectionHandlers`
  Adds a `SelectionEvent` handler.

  Specified by:
    `addSelectionHandler` in interface `HasSelectionHandlers<SuggestOracle.Suggestion>`
  Parameters:
    `handler` - the handler
  Returns:
    the registration for the event

### addValueChangeHandler

    public HandlerRegistration addValueChangeHandler(ValueChangeHandler<java.lang.String> handler)

  Description copied from interface: `HasValueChangeHandlers`
  Adds a `ValueChangeEvent` handler.

  Specified by:
    `addValueChangeHandler` in interface `HasValueChangeHandlers<java.lang.String>`
  Parameters:
    `handler` - the handler
  Returns:
    the registration for the event

### asEditor

    public LeafValueEditor<java.lang.String> asEditor()

  Returns a `TakesValueEditor` backed by the SuggestBox.

  Specified by:
    `asEditor` in interface `IsEditor<LeafValueEditor<java.lang.String>>`
  Returns:
    an `Editor` of type E

### getLimit

    public int getLimit()

  Gets the limit for the number of suggestions that should be displayed for this box. It is up to the current `SuggestOracle` to enforce this limit.

  Returns:
    the limit for the number of suggestions

### getSuggestionDisplay

    public SuggestBox.SuggestionDisplay getSuggestionDisplay()

  Get the `SuggestBox.SuggestionDisplay` used to display suggestions.

  Returns:
    the `SuggestBox.SuggestionDisplay`

### getSuggestOracle

    public SuggestOracle getSuggestOracle()

  Gets the suggest box's `SuggestOracle`.

  Returns:
    the `SuggestOracle`

### getTabIndex

    public int getTabIndex()

  Description copied from interface: `Focusable`
  Gets the widget's position in the tab index.

  Specified by:
    `getTabIndex` in interface `Focusable`
  Returns:
    the widget's tab index

### getText

    public java.lang.String getText()

  Description copied from interface: `HasText`
  Gets this object's text.

  Specified by:
    `getText` in interface `HasText`
  Returns:
    the object's text

### getTextBox

    @Deprecated
    public TextBoxBase getTextBox()

  Deprecated. in favour of getValueBox

  Get the text box associated with this suggest box.

  Returns:
    this suggest box's text box
  Throws:
    `java.lang.ClassCastException` - if this suggest box's value box is not an instance of TextBoxBase

### getValue

    public java.lang.String getValue()

  Description copied from interface: `HasValue`
  Gets this object's value.

  Specified by:
    `getValue` in interface `TakesValue<java.lang.String>`
  Specified by:
    `getValue` in interface `HasValue<java.lang.String>`
  Returns:
    the object's value
  See Also:
    `TakesValue.setValue(V)`

### getValueBox

    public ValueBoxBase<java.lang.String> getValueBox()

  Get the ValueBoxBase associated with this suggest box.

  Returns:
    this suggest box's value box

### hideSuggestionList

    @Deprecated
    public void hideSuggestionList()

  Deprecated. use `SuggestBox.DefaultSuggestionDisplay.hideSuggestions()` instead

  Hide current suggestions in the `SuggestBox.DefaultSuggestionDisplay`. Note that this method is a no-op unless the `SuggestBox.DefaultSuggestionDisplay` is used.

### isAnimationEnabled

    @Deprecated
    public boolean isAnimationEnabled()

  Deprecated. use `SuggestBox.DefaultSuggestionDisplay.isAnimationEnabled()` instead

  Check whether or not the `SuggestBox.DefaultSuggestionDisplay` has animations enabled. Note that this method only has a meaningful return value when the `SuggestBox.DefaultSuggestionDisplay` is used.

  Specified by:
    `isAnimationEnabled` in interface `HasAnimation`

### isAutoSelectEnabled

    public boolean isAutoSelectEnabled()

  Returns whether or not the first suggestion will be automatically selected. This behavior is on by default.

  Returns:
    true if the first suggestion will be automatically selected

### isEnabled

    public boolean isEnabled()

  Gets whether this widget is enabled.

  Specified by:
    `isEnabled` in interface `HasEnabled`
  Returns:
    `true` if the widget is enabled

### isSuggestionListShowing

    @Deprecated
    public boolean isSuggestionListShowing()

  Deprecated. use `SuggestBox.DefaultSuggestionDisplay.isSuggestionListShowing()`

  Check if the `SuggestBox.DefaultSuggestionDisplay` is showing. Note that this method only has a meaningful return value when the `SuggestBox.DefaultSuggestionDisplay` is used.

  Returns:
    true if the list of suggestions is currently showing, false if not

### refreshSuggestionList

    public void refreshSuggestionList()

  Refreshes the current list of suggestions.

### removeChangeListener

    @Deprecated
    public void removeChangeListener(ChangeListener listener)

  Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `getTextBox()`().addChangeHandler instead

  Description copied from interface: `SourcesChangeEvents`
  Removes a previously added listener interface.

  Specified by:
    `removeChangeListener` in interface `SourcesChangeEvents`
  Parameters:
    `listener` - the listener interface to remove

### removeClickListener

    @Deprecated
    public void removeClickListener(ClickListener listener)

  Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `getTextBox()`().addClickHandler instead

  Description copied from interface: `SourcesClickEvents`
  Removes a previously added listener interface.

  Specified by:
    `removeClickListener` in interface `SourcesClickEvents`
  Parameters:
    `listener` - the listener interface to remove

### removeEventHandler

    @Deprecated
    public void removeEventHandler(SuggestionHandler handler)

  Deprecated. Use the `HandlerRegistration.removeHandler()` method no the object returned by `addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler)` instead

  Description copied from interface: `FiresSuggestionEvents`
  Removes a previously added handler interface.

  Specified by:
    `removeEventHandler` in interface `FiresSuggestionEvents`
  Parameters:
    `handler` - the handler to remove

### removeFocusListener

    @Deprecated
    public void removeFocusListener(FocusListener listener)

  Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `getTextBox()`().addFocusListener instead

  Description copied from interface: `SourcesFocusEvents`
  Removes a previously added listener interface.

  Specified by:
    `removeFocusListener` in interface `SourcesFocusEvents`
  Parameters:
    `listener` - the listener interface to remove

### removeKeyboardListener

    @Deprecated
    public void removeKeyboardListener(KeyboardListener listener)

  Deprecated. Use the `HandlerRegistration.removeHandler()` method on the object returned by `getTextBox()`().add*Handler instead

  Description copied from interface: `SourcesKeyboardEvents`
  Removes a previously added listener interface.

  Specified by:
    `removeKeyboardListener` in interface `SourcesKeyboardEvents`
  Parameters:
    `listener` - the listener interface to remove

### setAccessKey

    public void setAccessKey(char key)

  Description copied from interface: `Focusable`
  Sets the widget's 'access key'. This key is used (in conjunction with a browser-specific modifier key) to automatically focus the widget.

  Specified by:
    `setAccessKey` in interface `Focusable`
  Parameters:
    `key` - the widget's access key

### setAnimationEnabled

    @Deprecated
    public void setAnimationEnabled(boolean enable)

  Deprecated. use `SuggestBox.DefaultSuggestionDisplay.setAnimationEnabled(boolean)` instead

  Enable or disable animations in the `SuggestBox.DefaultSuggestionDisplay`. Note that this method is a no-op unless the `SuggestBox.DefaultSuggestionDisplay` is used.

  Specified by:
    `setAnimationEnabled` in interface `HasAnimation`
  Parameters:
    `enable` - true to enable, false to disable

### setAutoSelectEnabled

    public void setAutoSelectEnabled(boolean selectsFirstItem)

  Turns on or off the behavior that automatically selects the first suggested item. This behavior is on by default.

  Parameters:
    `selectsFirstItem` - Whether or not to automatically select the first suggestion

### setEnabled

    public void setEnabled(boolean enabled)

  Sets whether this widget is enabled.

  Specified by:
    `setEnabled` in interface `HasEnabled`
  Parameters:
    `enabled` - `true` to enable the widget, `false` to disable it

### setFocus

    public void setFocus(boolean focused)

  Description copied from interface: `Focusable`
  Explicitly focus/unfocus this widget. Only one widget can have focus at a time, and the widget that does will receive all keyboard events.

  Specified by:
    `setFocus` in interface `Focusable`
  Parameters:
    `focused` - whether this widget should take focus or release it

### setLimit

    public void setLimit(int limit)

  Sets the limit to the number of suggestions the oracle should provide. It is up to the oracle to enforce this limit.

  Parameters:
    `limit` - the limit to the number of suggestions provided

### setPopupStyleName

    @Deprecated
    public void setPopupStyleName(java.lang.String style)

  Deprecated. use `SuggestBox.DefaultSuggestionDisplay.setPopupStyleName(String)` instead

  Sets the style name of the suggestion popup in the `SuggestBox.DefaultSuggestionDisplay`. Note that this method is a no-op unless the `SuggestBox.DefaultSuggestionDisplay` is used.

  Parameters:
    `style` - the new primary style name
  See Also:
    `UIObject.setStyleName(String)`

### setTabIndex

    public void setTabIndex(int index)

  Description copied from interface: `Focusable`
  Sets the widget's position in the tab index. If more than one widget has the same tab index, each such widget will receive focus in an arbitrary order. Setting the tab index to `-1` will cause this widget to be removed from the tab order.

  Specified by:
    `setTabIndex` in interface `Focusable`
  Parameters:
    `index` - the widget's tab index

### setText

    public void setText(java.lang.String text)

  Description copied from interface: `HasText`
  Sets this object's text.

  Specified by:
    `setText` in interface `HasText`
  Parameters:
    `text` - the object's new text

### setValue

    public void setValue(java.lang.String newValue)

  Description copied from interface: `HasValue`
  Sets this object's value without firing any events. This should be identical to calling setValue(value, false).

  It is acceptable to fail assertions or throw (documented) unchecked exceptions in response to bad values.

  Widgets must accept null as a valid value. By convention, setting a widget to null clears value, calling getValue() on a cleared widget returns null. Widgets that can not be cleared (e.g. `CheckBox`) must find another valid meaning for null input.

  Specified by:
    `setValue` in interface `TakesValue<java.lang.String>`
  Specified by:
    `setValue` in interface `HasValue<java.lang.String>`
  Parameters:
    `newValue` - the object's new value
  See Also:
    `TakesValue.getValue()`

### setValue

    public void setValue(java.lang.String value,
                         boolean fireEvents)

  Description copied from interface: `HasValue`
  Sets this object's value. Fires `ValueChangeEvent` when fireEvents is true and the new value does not equal the existing value.

  It is acceptable to fail assertions or throw (documented) unchecked exceptions in response to bad values.

  Specified by:
    `setValue` in interface `HasValue<java.lang.String>`
  Parameters:
    `value` - the object's new value
    `fireEvents` - fire events if true and value is new

### showSuggestionList

    public void showSuggestionList()

  Show the current list of suggestions.

### onEnsureDebugId

    protected void onEnsureDebugId(java.lang.String baseID)

  Description copied from class: `UIObject`
  Called when the user sets the id using the `UIObject.ensureDebugId(String)` method. Subclasses of `UIObject` can override this method to add IDs to their sub elements. If a subclass does override this method, it should list the IDs (relative to the base ID), that will be applied to each sub `Element` with a short description. For example:
  - -mysubelement = Applies to my sub element.
  Subclasses should make a super call to this method to ensure that the ID of the main element is set. This method will not be called unless you inherit the DebugID module in your gwt.xml file by adding the following line:

       <inherits name="com.google.gwt.user.Debug"/>

  Overrides:
    `onEnsureDebugId` in class `UIObject`
  Parameters:
    `baseID` - the base ID used by the main element

### showSuggestions

    void showSuggestions(java.lang.String query)

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD