如何删除GWT中的ClickHandler事件?我为一个按钮添加了addClickHandler()事件,我想删除ClickHandler Event.I尝试了HandlerRegistration方法但是它无法删除处理程序,这是一个片段:
notification.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // TODO Auto-generated method stub
        }
    });  
Run Code Online (Sandbox Code Playgroud)
我想通知删除处理程序!
Note:
Notification is the button instance that calls the handler!
Run Code Online (Sandbox Code Playgroud)
    Har*_*hra 22
每个add...Handler方法都返回HandlerRegistration接口.该接口包含该removeHandler()方法.如果要删除处理程序,只需将返回的接口存储在变量中,并在要删除处理程序时调用removeHandler.
HandlerRegistration handler;
handler = button.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                // ...
            }
        });
handler.removeHandler();            
Run Code Online (Sandbox Code Playgroud)