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(ClickHandler handler) {
        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 click
handler from the clickHandlers list
        return null;
    }

    public void onClick(ClickEvent event) {
        if (enabled) {
            for (ClickHandler handler : 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to