You might be interested in issue #3409 (link below), which requests
parameterization of the Suggestion/SelectionHandler API to allow for
type-safe access to suggestions such as your UserSuggestion. It's
already been accepted for "next release" but it wouldn't hurt to add
your star and/or comments.

http://code.google.com/p/google-web-toolkit/issues/detail?id=3409&can=4

- Isaac



On Thu, Mar 5, 2009 at 6:09 AM, CMB <[email protected]> wrote:
>
> Hi, I've tried to add a selection handler to a suggestbox onSelection
> where I expect that the Suggestion is my UserSuggestion that extends
> IsSerializable and Suggestion but eclipse is having some objections:
> The method addSelectionHandler
> (SelectionHandler<SuggestOracle.Suggestion>) in the type SuggestBox is
> not applicable for the arguments (new SelectionHandler<UserSuggestion>
> (){})
>
> suggestBox.addSelectionHandler(new SelectionHandler<UserSuggestion>(){
>
>                        public void onSelection(SelectionEvent<UserSuggestion> 
> event) {
>                                Long id = event.getSelectedItem().getId();
>                                RootPanel.get("").add(new Label(id));
>                        }
>
>                });
>
> looking at the SuggestBox sources, would a raw type that extends
> Suggestion do the trick (and would the gwt compiler know how to
> translate to javascript)?
>
>  public HandlerRegistration addSelectionHandler(
>      SelectionHandler<Suggestion> handler) {
>    return addHandler(handler, SelectionEvent.getType());
>  }
>
>  public HandlerRegistration addSelectionHandler(
>      SelectionHandler<? extends Suggestion> handler) {
>    return addHandler(handler, SelectionEvent.getType());
>  }
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to