public static class

SuggestBox.DefaultSuggestionDisplay

extends SuggestBox.SuggestionDisplay
implements HasAnimation
java.lang.Object
   ↳ com.google.gwt.user.client.ui.SuggestBox.SuggestionDisplay
     ↳ com.google.gwt.user.client.ui.SuggestBox.DefaultSuggestionDisplay

Class Overview

The default implementation of SuggestBox.SuggestionDisplay displays suggestions in a PopupPanel beneath the SuggestBox.

CSS Style Rules

.gwt-SuggestBoxPopup
the suggestion popup
.gwt-SuggestBoxPopup .item
an unselected suggestion
.gwt-SuggestBoxPopup .item-selected
a selected suggestion
.gwt-SuggestBoxPopup .suggestPopupTopLeft
the top left cell
.gwt-SuggestBoxPopup .suggestPopupTopLeftInner
the inner element of the cell
.gwt-SuggestBoxPopup .suggestPopupTopCenter
the top center cell
.gwt-SuggestBoxPopup .suggestPopupTopCenterInner
the inner element of the cell
.gwt-SuggestBoxPopup .suggestPopupTopRight
the top right cell
.gwt-SuggestBoxPopup .suggestPopupTopRightInner
the inner element of the cell
.gwt-SuggestBoxPopup .suggestPopupMiddleLeft
the middle left cell
.gwt-SuggestBoxPopup .suggestPopupMiddleLeftInner
the inner element of the cell
.gwt-SuggestBoxPopup .suggestPopupMiddleCenter
the middle center cell
.gwt-SuggestBoxPopup .suggestPopupMiddleCenterInner
the inner element of the cell
.gwt-SuggestBoxPopup .suggestPopupMiddleRight
the middle right cell
.gwt-SuggestBoxPopup .suggestPopupMiddleRightInner
the inner element of the cell
.gwt-SuggestBoxPopup .suggestPopupBottomLeft
the bottom left cell
.gwt-SuggestBoxPopup .suggestPopupBottomLeftInner
the inner element of the cell
.gwt-SuggestBoxPopup .suggestPopupBottomCenter
the bottom center cell
.gwt-SuggestBoxPopup .suggestPopupBottomCenterInner
the inner element of the cell
.gwt-SuggestBoxPopup .suggestPopupBottomRight
the bottom right cell
.gwt-SuggestBoxPopup .suggestPopupBottomRightInner
the inner element of the cell

Summary

Public Constructors
SuggestBox.DefaultSuggestionDisplay()
Public Methods
void hideSuggestions()
Hide the list of suggestions from view.
boolean isAnimationEnabled()
Returns true if animations are enabled, false if not.
boolean isSuggestionListHiddenWhenEmpty()
Check whether or not the suggestion list is hidden when there are no suggestions to display.
boolean isSuggestionListShowing()
Check whether or not the list of suggestions is being shown.
void setAnimationEnabled(boolean enable)
Enable or disable animations.
void setPopupStyleName(String style)
Sets the style name of the suggestion popup.
void setPositionRelativeTo(UIObject uiObject)
Sets the UI object where the suggestion display should appear next to.
void setSuggestionListHiddenWhenEmpty(boolean hideWhenEmpty)
Set whether or not the suggestion list should be hidden when there are no suggestions to display.
Protected Methods
PopupPanel createPopup()
Create the PopupPanel that will hold the list of suggestions.
Widget decorateSuggestionList(Widget suggestionList)
Wrap the list of suggestions before adding it to the popup.
SuggestOracle.Suggestion getCurrentSelection()
Get the currently selected SuggestOracle.Suggestion in the display.
PopupPanel getPopupPanel()
Get the PopupPanel used to display suggestions.
void moveSelectionDown()
Highlight the suggestion directly below the current selection in the list.
void moveSelectionUp()
Highlight the suggestion directly above the current selection in the list.
void onEnsureDebugId(String baseID)
Affected Elements:
  • -popup = The popup that appears with suggestions.
void showSuggestions(SuggestBox suggestBox, Collection<? extends SuggestOracle.Suggestion> suggestions, boolean isDisplayStringHTML, boolean isAutoSelectEnabled, SuggestBox.SuggestionCallback callback)
Update the list of visible suggestions.
[Expand]
Inherited Methods
From class com.google.gwt.user.client.ui.SuggestBox.SuggestionDisplay
From class java.lang.Object
From interface com.google.gwt.user.client.ui.HasAnimation

Public Constructors

public SuggestBox.DefaultSuggestionDisplay ()

Public Methods

public void hideSuggestions ()

Hide the list of suggestions from view.

public boolean isAnimationEnabled ()

Returns true if animations are enabled, false if not.

public boolean isSuggestionListHiddenWhenEmpty ()

Check whether or not the suggestion list is hidden when there are no suggestions to display.

Returns
  • true if hidden when empty, false if not

public boolean isSuggestionListShowing ()

Check whether or not the list of suggestions is being shown.

Returns
  • true if the suggestions are visible, false if not

public void setAnimationEnabled (boolean enable)

Enable or disable animations.

Parameters
enable true to enable, false to disable

public void setPopupStyleName (String style)

Sets the style name of the suggestion popup.

Parameters
style the new primary style name

public void setPositionRelativeTo (UIObject uiObject)

Sets the UI object where the suggestion display should appear next to.

Parameters
uiObject the uiObject used for positioning, or null to position relative to the suggest box

public void setSuggestionListHiddenWhenEmpty (boolean hideWhenEmpty)

Set whether or not the suggestion list should be hidden when there are no suggestions to display. Defaults to true.

Parameters
hideWhenEmpty true to hide when empty, false not to

Protected Methods

protected PopupPanel createPopup ()

Create the PopupPanel that will hold the list of suggestions.

Returns
  • the popup panel

protected Widget decorateSuggestionList (Widget suggestionList)

Wrap the list of suggestions before adding it to the popup. You can override this method if you want to wrap the suggestion list in a decorator.

Parameters
suggestionList the widget that contains the list of suggestions
Returns
  • the suggestList, optionally inside of a wrapper

protected SuggestOracle.Suggestion getCurrentSelection ()

Get the currently selected SuggestOracle.Suggestion in the display.

Returns
  • the current suggestion, or null if none selected

protected PopupPanel getPopupPanel ()

Get the PopupPanel used to display suggestions.

Returns
  • the popup panel

protected void moveSelectionDown ()

Highlight the suggestion directly below the current selection in the list.

protected void moveSelectionUp ()

Highlight the suggestion directly above the current selection in the list.

protected void onEnsureDebugId (String baseID)

Affected Elements:

  • -popup = The popup that appears with suggestions.
  • -item# = The suggested item at the specified index.

Parameters
baseID the baseID of the SuggestBox

protected void showSuggestions (SuggestBox suggestBox, Collection<? extends SuggestOracle.Suggestion> suggestions, boolean isDisplayStringHTML, boolean isAutoSelectEnabled, SuggestBox.SuggestionCallback callback)

Update the list of visible suggestions. Use care when using isDisplayStringHtml; it is an easy way to expose script-based security problems.

Parameters
suggestBox the suggest box where the suggestions originated
suggestions the suggestions to show
isDisplayStringHTML should the suggestions be displayed as HTML
isAutoSelectEnabled if true, the first item should be selected automatically
callback the callback used when the user makes a suggestion