Package com.google.gwt.user.client.ui
Class SuggestBox.DefaultSuggestionDisplay
- java.lang.Object
-
- com.google.gwt.user.client.ui.SuggestBox.SuggestionDisplay
-
- com.google.gwt.user.client.ui.SuggestBox.DefaultSuggestionDisplay
-
- All Implemented Interfaces:
HasAnimation
- Enclosing class:
- SuggestBox
public static class SuggestBox.DefaultSuggestionDisplay extends SuggestBox.SuggestionDisplay implements HasAnimation
The default implementation of
SuggestBox.SuggestionDisplay
displays suggestions in aPopupPanel
beneath theSuggestBox
.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
-
-
Constructor Summary
Constructors Constructor Description DefaultSuggestionDisplay()
Construct a newSuggestBox.DefaultSuggestionDisplay
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 selectedSuggestOracle.Suggestion
in the display.protected PopupPanel
getPopupPanel()
Get thePopupPanel
used to display suggestions.protected MenuBar
getSuggestionMenu()
Get theMenuBar
used to display suggestions.void
hideSuggestions()
Hide the list of suggestions from view.boolean
isAnimationEnabled()
Returns true if animations are enabled, false if not.(package private) boolean
isAnimationEnabledImpl()
This is here for legacy reasons.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(java.lang.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.(package private) void
setAnimationEnabledImpl(boolean enable)
This is here for legacy reasons.void
setPopupStyleName(java.lang.String style)
Sets the style name of the suggestion popup.(package private) void
setPopupStyleNameImpl(java.lang.String style)
This is here for legacy reasons.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, java.util.Collection<? extends SuggestOracle.Suggestion> suggestions, boolean isDisplayStringHTML, boolean isAutoSelectEnabled, SuggestBox.SuggestionCallback callback)
Update the list of visible suggestions.-
Methods inherited from class com.google.gwt.user.client.ui.SuggestBox.SuggestionDisplay
setMoreSuggestions
-
-
-
-
Constructor Detail
-
DefaultSuggestionDisplay
public DefaultSuggestionDisplay()
Construct a newSuggestBox.DefaultSuggestionDisplay
.
-
-
Method Detail
-
hideSuggestions
public void hideSuggestions()
Description copied from class:SuggestBox.SuggestionDisplay
Hide the list of suggestions from view.- Specified by:
hideSuggestions
in classSuggestBox.SuggestionDisplay
-
isAnimationEnabled
public boolean isAnimationEnabled()
Description copied from interface:HasAnimation
Returns true if animations are enabled, false if not.- Specified by:
isAnimationEnabled
in interfaceHasAnimation
-
isSuggestionListHiddenWhenEmpty
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
-
isSuggestionListShowing
public boolean isSuggestionListShowing()
Description copied from class:SuggestBox.SuggestionDisplay
Check whether or not the list of suggestions is being shown.- Overrides:
isSuggestionListShowing
in classSuggestBox.SuggestionDisplay
- Returns:
- true if the suggestions are visible, false if not
-
setAnimationEnabled
public void setAnimationEnabled(boolean enable)
Description copied from interface:HasAnimation
Enable or disable animations.- Specified by:
setAnimationEnabled
in interfaceHasAnimation
- Parameters:
enable
- true to enable, false to disable
-
setPopupStyleName
public void setPopupStyleName(java.lang.String style)
Sets the style name of the suggestion popup.- Parameters:
style
- the new primary style name- See Also:
UIObject.setStyleName(String)
-
setPositionRelativeTo
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
-
setSuggestionListHiddenWhenEmpty
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
-
createPopup
protected PopupPanel createPopup()
Create the PopupPanel that will hold the list of suggestions.- Returns:
- the popup panel
-
decorateSuggestionList
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
-
getCurrentSelection
protected SuggestOracle.Suggestion getCurrentSelection()
Description copied from class:SuggestBox.SuggestionDisplay
Get the currently selectedSuggestOracle.Suggestion
in the display.- Specified by:
getCurrentSelection
in classSuggestBox.SuggestionDisplay
- Returns:
- the current suggestion, or null if none selected
-
getPopupPanel
protected PopupPanel getPopupPanel()
Get thePopupPanel
used to display suggestions.- Returns:
- the popup panel
-
getSuggestionMenu
protected MenuBar getSuggestionMenu()
Get theMenuBar
used to display suggestions.- Returns:
- the suggestions menu
-
moveSelectionDown
protected void moveSelectionDown()
Description copied from class:SuggestBox.SuggestionDisplay
Highlight the suggestion directly below the current selection in the list.- Specified by:
moveSelectionDown
in classSuggestBox.SuggestionDisplay
-
moveSelectionUp
protected void moveSelectionUp()
Description copied from class:SuggestBox.SuggestionDisplay
Highlight the suggestion directly above the current selection in the list.- Specified by:
moveSelectionUp
in classSuggestBox.SuggestionDisplay
-
onEnsureDebugId
protected void onEnsureDebugId(java.lang.String baseID)
Affected Elements:- -popup = The popup that appears with suggestions.
- -item# = The suggested item at the specified index.
- Overrides:
onEnsureDebugId
in classSuggestBox.SuggestionDisplay
- Parameters:
baseID
- the baseID of theSuggestBox
- See Also:
UIObject.onEnsureDebugId(String)
-
showSuggestions
protected void showSuggestions(SuggestBox suggestBox, java.util.Collection<? extends SuggestOracle.Suggestion> suggestions, boolean isDisplayStringHTML, boolean isAutoSelectEnabled, SuggestBox.SuggestionCallback callback)
Description copied from class:SuggestBox.SuggestionDisplay
Update the list of visible suggestions. Use care when using isDisplayStringHtml; it is an easy way to expose script-based security problems.- Specified by:
showSuggestions
in classSuggestBox.SuggestionDisplay
- Parameters:
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 suggestion
-
isAnimationEnabledImpl
boolean isAnimationEnabledImpl()
Description copied from class:SuggestBox.SuggestionDisplay
This is here for legacy reasons. It is intentionally not visible.- Overrides:
isAnimationEnabledImpl
in classSuggestBox.SuggestionDisplay
-
setAnimationEnabledImpl
void setAnimationEnabledImpl(boolean enable)
Description copied from class:SuggestBox.SuggestionDisplay
This is here for legacy reasons. It is intentionally not visible.- Overrides:
setAnimationEnabledImpl
in classSuggestBox.SuggestionDisplay
- Parameters:
enable
- true to enable animation
-
setPopupStyleNameImpl
void setPopupStyleNameImpl(java.lang.String style)
Description copied from class:SuggestBox.SuggestionDisplay
This is here for legacy reasons. It is intentionally not visible.- Overrides:
setPopupStyleNameImpl
in classSuggestBox.SuggestionDisplay
- Parameters:
style
- the style name
-
-