Thank you Thomas. I think the argument of changing the contract of A is pretty strong :) I will stick to the neater pattern as is.
Regards, Shahid On Jan 18, 8:59 am, Thomas Broyer <[email protected]> wrote: > On Jan 18, 9:54 am, shahid <[email protected]> wrote: > > > > > > > In my application I always define an inner handler classes > > (implementing a handler interface) for all sorts of events e.g. > > ClickHandler, ValueChangeHandler etc. and then I use them in the main > > (outer) class using NEW handerl(). I could however use the outer class > > to implement the interface itself. I wonder if that would make any > > difference to the application's size and speed: > > > class A { > > > class B implements ClickHandler { > > ..... onClick here .... > > > } > > > public void someMethod(){ > > Anchor a = new Anchor("Link"); > > a.addClickHandler(new B()); > > > } > > } > > > Will doing the following instead make any difference to the generated > > javascript's size and speed: > > > class A implements ClickHandler { > > ... implement the onClick ... > > > ... use addClickHandler(this) elsewhere in methods .... > > > } > > It would probably make a small difference, but I doubt it'd be > perceptible (even in our beloved sluggish IE6). > > Re. maintainability of your code though, you're changing the > "contract" of A, which is now a ClickHandler that "anyone" could > attach to "anything". > (that's the same rationale for using a Composite rather than deriving > an existing widget)
-- 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.
