On Mon, Oct 22, 2012 at 8:52 AM, Maik Riechert wrote:
> I'm using 2.5.0rc2 and find the Canvas class not useable if I use JS
> libraries through JSNI which give me canvas elements (I'm contributing to
> KineticGWT, a wrapper for KineticJS). There's no wrap() method like in the
> other widget classes and I can't even solve it by subclassing Canvas, as
> the constructor is private: private Canvas(CanvasElement element).
>
I haven't tried it personally, but you should be able to use the "violator
pattern" and call the private constructor from a JSNI method:
public static native Canvas createCanvas(CanvasElement element) /*-{
@com.google.gwt.canvas.client.Canvas::new(Lcom/google/gwt/dom/client/CanvasElement;)(element);
}
I don't know what else you will have to deal with for supplying the element
externally, but that should get you past the access control issue.
--
John A. Tamplin
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors