The more code I implement and the more event-related APIs I look at in GWT, the more confused I get. After looking at complete examples about 'listeners' on website such as: http://examples.roughian.com/index.htm#Listeners~Summary or posts in this group, I conclude that the most general is an 'EventListener', because then I can get at ANY/ALL events that I might be interested in, as it's method gets 'Event e' as an input param. But, what seems to me like a real NEGATIVE is that I must 'extend' (sub-class) an object to use EventListener, right?
Now, if I only care about a 'click', then I do NOT need to extend, because there are 'clicklisteners', which listen for just ONE event type...'click'. But, if I want, say, 'double-click', well, there are NOT any 'double-click' listeners, so it seems that I'll need to use the more general EventListener. That would be reasonable/acceptable if there was just ONE object that I wanted/needed to extend in a given app. But, let's say, I care about 'doubleclicks' from 3 different objects in the same app...anchors, tabs, and images. (Maybe not the best examples, but bear with me.) So, it seems that now I need to extend three objects, so I'll need 3 java classes (and thus, ...3 FILES...one class per file). [Some posts/examples mention 'widget builders' as a separate class of developer. But, I don't want to build new 'widgets'... I just want a write a simple app. Somehow, the APIs seem to be making things unnecessarily 'complex', when I compare this to how easy it was to implement events in javascript language (before I started using GWT). And, its beginning to seem like the designers of the event-model/event-apis in GWT might have miss-designed the APIs?! (I wasn't around at the beginning, so I don't know how the event-APIs looked in version 1.00.) Both the author of roughian website and other posters all seem to bemoan this need to extend, but all say it is necessary. For example, roughian says: [Notes: This is something you should only use if you are subclassing a widget - it's not much use otherwise, you can't addEventListener() to anything I'm aware of. So, as a builder of widgets, you'd use this to pick up events and use them in ways that you can't do with the ordinarily supported event interfaces] Clearly, I (and others?) must all be missing something. Where have I gone wrong? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
