tags:

views:

621

answers:

1

Hi everyone,

I have an app that uses the GWT-Incubator GlassPanel class.

I extended it to form a custom one that implemented a ClickListener. I upgraded to GWT1.7 and GWT-Incubator 1.7, and it broke ClickListener.

I tried to rewrite my class so that it implemented ClickHandler, but it does not execute my new onClick method when the panel is clicked.

Anyone know anything about this?

Thanks

example:

public class MyGlassPanel extends GlassPanel implements ClickHandler{

public void onClick(ClickEvent arg0){
     Window.alert("There was a click, but I never get displayed");
     this.remove();
}

}
+1  A: 

If you wish to receive click events off of your GlassPanel you could try this; Implementing a clickhandler callback.

public class MyGlassPanel extends GlassPanel implements HasClickHandler{

 @Override
 public HandlerRegistration addClickHandler(ClickHandler handler) {
  return addDomHandler(handler, ClickEvent.getType());
 }
}

MyGlassPanel glassPanel = new MyGlassPanel();

//add a clickhandler by passing in an anonymous class handler
glassPanel.addClickHandler(new ClickHandler() {
 @Override
 public void onClick(ClickEvent event) {
  Window.alert("hello world!");
 }
});

Or you could issue a handle inside of the class with

this.addClickHandler(new ClickHandler(){...});
Baileys