tags:

views:

60

answers:

0

Hi,

I am trying to add clicklistener to one of the widgets. These widgets are created using RaphaleJS. I tried to implement clicklistener but it is not recognizing. i.e. i have something like this:

class RaphaelJS extends JavaScriptObject { protected static class Shape extends JavaScriptObject { public final native Shape rotate(double degree, boolean abs) /-{ return this.rotate(degree, abs); }-/; //....} public final native Shape rect(double x, double y, double w, double h) /-{ return this.rect(x, y, w, h); }-/; //...}

public class Raphael extends Widget { private RaphaelJS overlay; public class Shape extends Widget { protected RaphaelJS.Shape rs; public Shape rotate(double degree, boolean isAbsolute) { rs.rotate(degree, isAbsolute); return this; } //... } public class Rectangle extends Shape { public Rectangle(double x, double y, double w, double h) { super(overlay.rect(x, y, w, h)); } public Rectangle(double x, double y, double w, double h, double r) { super(overlay.rect(x, y, w, h, r)); } } //.... }

public class MyDrawing extends Raphael implements ClickListener{ public MyDrawing() { super(width, height); Rectangle r = new Rectangle(10,10, 50, 20); r.addClickListener(new ClickListener() { public void onClick(Widget sender) { // do something here } }); // Raphael automatically appends the Rectangle to this drawing } }

public class MyApp implements EntryPoint { public void onModuleLoad() { MyDrawing d = new MyDrawing(); RootPanel.get().add(d); } }

but it is not recognizing the addClickListener function. Any help would be appreciated.

Thank you.