Re: [gwt-contrib] Adding wrap method to Canvas and/or make constructor protected

2012-10-25 Thread John A. Tamplin
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

[gwt-contrib] Adding wrap method to Canvas and/or make constructor protected

2012-10-25 Thread Maik Riechert
Hi,

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).

This issue has been raised a year ago here:

https://groups.google.com/d/topic/google-web-toolkit/xNA8wPpp9RY/discussion

Could this be fixed for the final 2.5.0?

Cheers
Maik

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors