I've been doing this so much lately I've memorized the code. Using
eclipse you'll quickly get proficient at it I'm sure:

class Handlers implements HasMouseOverHandlers, HasMouseOutHandlers {
  public void onMouseOver(MouseOverEvent e) {
  }
  public void onMouseOut(MouseOutEvent e) {
  }
}

If you're implementing a new Widget:

class Foo extends Widget implements HasMouseOverHandlers,
HasMouseOutHandlers {
  public HandlerRegistration addMouseOverHandler(MouseOverHandler
handler) {
    return addDomHandler(handler, MouseOverHandler.getType());
  }

  public HandlerRegistration addMouseOutHandler(MouseOutHandler
handler) {
    return addDomHandler(handler, MouseOutHandler.getType());
  }
}

That's it! No more onBrowserEvent, no more sinkEvents. It's all
automatic. Sweet huh?
As for what to do with the HandlerRegistration, read the docs ;-)

Oh, on a related note/warning: I really think GWT should WARN if you
call addHandler with an event type that implements HasNativeEvent. If
you call addHandler instead of addDomHandler, nothing happens and no
events will ever be fired because the events don't get listeners
added. This has already bit me a couple times. Worth filing a bug for
this?


On May 17, 2:03 pm, Salvador Diaz <diaz.salva...@gmail.com> wrote:
> onMouseLeave:http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g...
>
> onMouseEnter (I don't know which so you'll have to try them 
> out):http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g...
> orhttp://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g...
>
> Hope that helps,
>
> Salvador
>
> On May 17, 7:00 pm, Paul van Hoven <paul.van.ho...@googlemail.com>
> wrote:
>
> > I imported an GWT 1.5 app for transforming it to a GWT 1.6 app. Every
> > listener is now marked as deprecated, so i'm currently replacing all
> > these. Anyway i do not know how to replace my MouseListener
> > implementations. Concretly speaking i use the folling implementations
>
> >        public void onMouseEnter(Widget sender) {
> >                 //..do s.th. here
> >         }
>
> >         public void onMouseLeave(Widget sender) {
> >                 //..do s.th. here
> >         }
>
> > that are demanded by the MouseListener interface. But i have not
> > figured out yet how to replace these with the new handler interfaces.
> > Does somebody know how to accomplish this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to