So, after having my errors pointed out to me, I did my research and realized that I was talking about HandlerRegistrations, not HandlerManager. Oops...
...I've been trying to avoid as much of the Collections routines in favor of custom JSNI stacks; they might obscure bugs, but they run much faster. Anyway, if you need an event model where you can turn one source widget into another, why not just make a static class, widgetMapper, with a static private Map<Widget,Widget> map //or Map<Widget,WidgetCollection> {If you need one-to-many}, public static Widget delegate(Widget x){ return map.containsKey(x)?map.get(x):x; } Then just call Widget src = widgetMapper.delegate(((Widget) event.getSource()); inside your handlers. Since you've already overridden HandlerManager, consider adding a static field: lastWidget, which is either the Source Widget, or it's delegate source. If your root event panel needs to forward events with a modified Source object, widgetMapper.delegate(((Widget)event.getSource()).fireEvent(event); if you aren't forwarding the events to widgets with registered handlers, you don't need to change the event's Source object, you just need to turn the supplied Source into your desired Source. Furthermore, if you need to do some testing before calling fireEvent, make a testing interface that accepts two Widgets, and returns boolean. You could then send your events to a static function that checks for a delegate widget. then checks for a test object linked to the widgets, then, if test(x,y)==true, set a static Widget/ WidgetCollection instance to the delegate object and return true. Then, your specific handlers can do if(widgetMapper.isValid(event)) {Widget newSource = widgetMapper.getLastWidget(); ...} ...You could even use generics or whatever you like. The benefit of doing this statically as opposed to instance prototypes is that your objects don't need to directly reference and re-reference each other {reduces memory leakage}. Also, you can get your code reuse you were looking for Anyway, I'm somewhat confused about what, exactly, you want... If you post some actual source of what you're doing, I'd probably be less abstract and maybe even make a little sense... All I know is that if you don't want to forward the event to Handlers added to sub-widgets, then your issue likely isn't with event.getSource(). I am likely wrong, but I don't really care. Personally, I like static list objects that link a Widgets hashCode to interface functions that take things like Event or Widget or whatever you need as a parameter, and then use a static function like xRun(int hash,Event x){ if (jsMap.hasKey(hash)) jsMap.castGet(hash).run(x); }xRun(Object hash,Event x){xRun(hash.hashCode(),x); xRun(event.getSource(),event); where jsMap extends JavaScriptObject, uses JSNI to map ints to Objects, and generics to return items in whatever class is needed. HashMap<Object,Event> could work, but HashMap<Widget,Event> would require a sometimes-needless cast from getSource() to Widget. Good luck friend! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---