I think you actually just want Widget sender = (Widget)event.getSource();, then you can continue as before..
On Apr 1, 7:45 pm, "t.dave" <[email protected]> wrote: > so i'm finally in the process of upgrading from 1.5.3 to 2.0, and > converting all my listeners to handlers. i have a listener class that > is always used in conjunction with an image - when the image is > clicked on the listener adds a style name indicating it's been > clicked. > > current code, in the class implementing ClickListener: > > public void onClick( Widget sender ) > { > sender.addStyleName( "clickedIcon" ); > if ( sender instanceof FocusWidget ) > ((FocusWidget) sender).setFocus( false ); > > } > > attempted replacement code, in class now implementing ClickHandler: > > public void onClick( ClickEvent event ) > { > event.getRelativeElement().setAttribute(.... maybe? ...); > event.getRelativeElement().blur(); > > } > > presumably i can always blur an Element, and as such don't need the > check for a FocusWidget equivalent. however, how can i add a style > name? am i going to have to modify the constructor of the class and > pass a reference to the Image Widget? > > any help on this would be much appreciated. thanks in advance! > > dave -- 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.
