Reviewers: jgw,

Description:
The API for SuggestBox is very private, making it almost impossible to
modify the PopupPanel used to display Suggestions, or to replace it with
a different type of widget altogether.  For example, you might want to
place a custom list beneath a suggest box that is always visible.

Fix:
====
This patch adds an abstract SuggestionDisplay class that is used by
SuggestBox to display new suggestions.  The only method that needs to be
implemented is SuggestionDisplay#showSuggestions(), which gives users a
lot of freedom to customize how suggestions are displayed.

In addition, the DefaultSuggestionDisplay implements the PopupPanel
mechanism that SuggestBox currently uses.  I've opened up the API to
make it easier to control how the PopupPanel and menu items will look.

Now that we've moved the PopupPanel implementation to a separate class,
we can safely open up the API.  The fear before is that if we opened up
access to the PopupPanel and other methods, we would have a harder time
doing a refactor such as this one which would allow non-PopupPanel
implementations.

There are a few methods in SuggestBox that are specific to the
PopupPanel implementation. I've deprecated all of them and provided
alternatives directly in DefaultSuggestionDisplay.  I'll add comments to
the source code describing why they are deprecated.


Testing:
=======
I manually verified that the SuggestBox still works exactly as it did
before, and all tests passed.

Please review this at http://gwt-code-reviews.appspot.com/129805

Affected files:
  user/src/com/google/gwt/user/client/ui/SuggestBox.java
  user/test/com/google/gwt/user/client/ui/SuggestBoxTest.java


-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to