If you just want the selected item then use
SuggestBox box = new SuggestBox(countryOracle);
box.addSelectionHandler(new SelectionHandler<Suggestion>() {
@Override
public void onSelection(SelectionEvent<Suggestion> event) {
System.out.println(event.getSelectedItem());
}
});
Or
SuggestBox box = new SuggestBox(countryOracle);
box.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChanged(ValueChangeEvent<String> event) {
System.out.println(event.getValue());
}
});
The first example gives you the object (country) that the user has
selected in the suggestion popup and the second one gives you the
string from the SuggestionBox's TextBox whenever it changes.
If you really want to override "protected abstract
SuggestOracle.Suggestion getCurrentSelection()" from the
SuggestionDisplay then you have to use
SuggestBox box = new SuggestBox(countryOracle, new TextBox(), new
YourCustomSuggestionDisplay());
where YourCustomSuggestionDisplay is
public class YourCustomSuggestionDisplay extends
DefaultSuggestionDisplay
or
public class YourCustomSuggestionDisplay extends
SuggestBox.SuggestionDisplay
Hope that helps.
On 15 Nov., 20:22, "seven.reeds" <[email protected]> wrote:
> Thanks,
>
> I am still such a java newbie that I was not thinking about the what I
> was really trying to accomplish. I didn't need an array of suggest
> boxes. Duh, on me.
>
> What I do need though is the proper way to get to the "protected"
> methods of the nested class: SuggestBox.SuggestionDisplay
>
> In there is the method
>
> protected abstract SuggestOracle.Suggestion
> getCurrentSelection()
>
> I have seen some java tutorials that say that I can get at this method
> if I correctly extend the class... but I do not seem to know how to
> properly extend the class.
>
> I have a suggest box and I have set up a valueChangeHandler. In there
> I would like to get the currently selected value but am at a loss as
> to how to make that work.
>
> help?
>
> s.r.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.