Check out GWT implementation of CustomButton. It seems that the goal can be achieved by overwrite onBrowserEvent (Event event) method without using the method proposed above.
FYI -Ben On Jun 23, 4:07 am, romant <[email protected]> wrote: > Ok, > I used just basic approach, if anyone is interested in enabling/ > disabling click events on your > own composite here it is: > > public class MyButton extends Composite implements HasClickHandlers, > ClickHandler { > > private final HashSet<ClickHandler> clickHandlers; > private boolean enabled; > > public MyButton() { > clickHandlers = new HashSet(); > addDomHandler(this, ClickEvent.getType()); > ....... > initWidget(<your_complex_widget>); > } > > public HandlerRegistration addClickHandler(ClickHandlerhandler) { > clickHandlers.add(handler); > // don't care about the return value, nobody should need it > // if necessary return some convenient class extending > HandlerRegistration > // or create some special method for removing the clickhandlerfrom > the clickHandlers list > return null; > } > > public void onClick(ClickEventevent) { > if (enabled) { > for (ClickHandlerhandler: clickHandlers) { > handler.onClick(event); > } > } > } > > public void setEnabled(boolean enabled) { > this.enabled = enabled; > } > > } > > Any suggestions for improvements are welcome. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
