public static class SuggestBox.DefaultSuggestionDisplay extends SuggestBox.SuggestionDisplay implements HasAnimation
The default implementation of SuggestBox.SuggestionDisplay
displays
suggestions in a PopupPanel
beneath the SuggestBox
.
Constructor and Description |
---|
DefaultSuggestionDisplay()
Construct a new
SuggestBox.DefaultSuggestionDisplay . |
Modifier and Type | Method and Description |
---|---|
protected PopupPanel |
createPopup()
Create the PopupPanel that will hold the list of suggestions.
|
protected Widget |
decorateSuggestionList(Widget suggestionList)
Wrap the list of suggestions before adding it to the popup.
|
protected SuggestOracle.Suggestion |
getCurrentSelection()
Get the currently selected
SuggestOracle.Suggestion in the display. |
protected PopupPanel |
getPopupPanel()
Get the
PopupPanel used to display suggestions. |
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.
|
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.
|
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 void |
showSuggestions(SuggestBox suggestBox,
Collection<? extends SuggestOracle.Suggestion> suggestions,
boolean isDisplayStringHTML,
boolean isAutoSelectEnabled,
SuggestBox.SuggestionCallback callback)
Update the list of visible suggestions.
|
setMoreSuggestions
public DefaultSuggestionDisplay()
SuggestBox.DefaultSuggestionDisplay
.public void hideSuggestions()
SuggestBox.SuggestionDisplay
hideSuggestions
in class SuggestBox.SuggestionDisplay
public boolean isAnimationEnabled()
HasAnimation
isAnimationEnabled
in interface HasAnimation
public boolean isSuggestionListHiddenWhenEmpty()
public boolean isSuggestionListShowing()
public void setAnimationEnabled(boolean enable)
HasAnimation
setAnimationEnabled
in interface HasAnimation
enable
- true to enable, false to disablepublic void setPopupStyleName(String style)
style
- the new primary style nameUIObject.setStyleName(String)
public void setPositionRelativeTo(UIObject uiObject)
uiObject
- the uiObject used for positioning, or null to position
relative to the suggest boxpublic void setSuggestionListHiddenWhenEmpty(boolean hideWhenEmpty)
hideWhenEmpty
- true to hide when empty, false not toprotected PopupPanel createPopup()
protected Widget decorateSuggestionList(Widget suggestionList)
suggestionList
- the widget that contains the list of suggestionsprotected SuggestOracle.Suggestion getCurrentSelection()
SuggestBox.SuggestionDisplay
SuggestOracle.Suggestion
in the display.getCurrentSelection
in class SuggestBox.SuggestionDisplay
protected PopupPanel getPopupPanel()
PopupPanel
used to display suggestions.protected void moveSelectionDown()
SuggestBox.SuggestionDisplay
moveSelectionDown
in class SuggestBox.SuggestionDisplay
protected void moveSelectionUp()
SuggestBox.SuggestionDisplay
moveSelectionUp
in class SuggestBox.SuggestionDisplay
protected void onEnsureDebugId(String baseID)
onEnsureDebugId
in class SuggestBox.SuggestionDisplay
baseID
- the baseID of the SuggestBox
UIObject.onEnsureDebugId(String)
protected void showSuggestions(SuggestBox suggestBox, Collection<? extends SuggestOracle.Suggestion> suggestions, boolean isDisplayStringHTML, boolean isAutoSelectEnabled, SuggestBox.SuggestionCallback callback)
SuggestBox.SuggestionDisplay
showSuggestions
in class SuggestBox.SuggestionDisplay
suggestBox
- the suggest box where the suggestions originatedsuggestions
- the suggestions to showisDisplayStringHTML
- should the suggestions be displayed as HTMLisAutoSelectEnabled
- if true, the first item should be selected
automaticallycallback
- the callback used when the user makes a suggestionCopyright © 2018. All rights reserved.