Re: Create Canvas widget from CanvasElement

2014-03-11 Thread confile
Hi I am working on a new Kineticjs GWT wrapper here: 
https://github.com/confile/gwt-kinetic

If someone wants to join my project please contact me.




Am Montag, 22. Oktober 2012 14:38:00 UTC+2 schrieb Maik Riechert:
>
> I stumbled upon the same thing today.
>
> I'm a contributor to KineticGWT which is a JSNI wrapper around the 
> KineticJS library. In this library, the canvas elements are created by the 
> library itself and I only get them. So I thought, when doing something like 
> layer.getCanvas() it would be best to use the Canvas widget, but still, as 
> of 2.5.0rc2 the constructor is private and there's no wrapper method. This 
> sucks! I'll see if it's already been mentioned in gwt-contributors.
>
> Cheers
> Maik
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Create Canvas widget from CanvasElement

2012-10-22 Thread Maik Riechert
I stumbled upon the same thing today.

I'm a contributor to KineticGWT which is a JSNI wrapper around the 
KineticJS library. In this library, the canvas elements are created by the 
library itself and I only get them. So I thought, when doing something like 
layer.getCanvas() it would be best to use the Canvas widget, but still, as 
of 2.5.0rc2 the constructor is private and there's no wrapper method. This 
sucks! I'll see if it's already been mentioned in gwt-contributors.

Cheers
Maik

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/yVEsWLmLvOYJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Create Canvas widget from CanvasElement

2011-08-12 Thread Julian

>
>
> constructor 
> protected CanvasElement() 
>
> It means that you can derive your own class for CanvasElement. 
> Adding it in a GWT container works for me. 
>
> I agree with you : I don't understand why there is also a Canvas 
> class, and why the constructor is private ? 
>
>
Canvas is a Widget (derives from FocusWidget).
CanvasElement is just a wrapper around the DOM element  (derives 
com.google.gwt.dom.client.Element).
To be precise, CanvasElement is not even a wrapper it is a JavaScriptObject 
which means that you can not create it in Java (by calling a constructor).
Instead, we have to use Document.get().createCanvasElement() which does its 
work by calling a JSNI method.
I want the widget so that I can do all the event handling in Java 
(FocusWidget implements tons of Has*Handlers interfaces). 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ivqyX2eFKScJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Create Canvas widget from CanvasElement

2011-08-12 Thread karim33
Hi Julian,

I work with GWT 2.3 and i just see in the documentation :
(http://google-web-toolkit.googlecode.com/svn/javadoc/2.3/com/google/
gwt/dom/client/CanvasElement.html)

constructor
protected CanvasElement()

It means that you can derive your own class for CanvasElement.
Adding it in a GWT container works for me.

I agree with you : I don't understand why there is also a Canvas
class, and why the constructor is private ?

In my opinion, Google is perfectionnist, and has provided a cross-
browser test class to check if  is supported by client
browser, in order to let the developper to test and take a decision if
there is no browser support. May be that's why thi class exists. I
don't think it's a bug as Thomas says.

Regards

Karim Duran


On 11 août, 22:06, Julian  wrote:
> I want to wrap a CanvasElement ( in HTML) in an Canvas widget.
>
> Many widgets (e.g. Label) have a static method SomeWidget.wrap(Element) for
> wrapping an existing DOM element.
> I imagine Canvas does not feature such a method because not all browser
> support  and therefore the user should be forced to go
> through createIfSupported().
>
> Unfortunately the constructor in Canvas is private, which means that Canvas
> can not be subclassed. (There isn't any constructor available in the derived
> class.)
>
> Code snippets of createIfSupported and the constructor in Canvas:
>
>   public static Canvas createIfSupported() {
>     // check if canvas is supported; if it is not supported: return null
>     return new Canvas(element);
>   }
>
>   private Canvas(CanvasElement element) {
>     setElement(element);
>   }
>
> I ended up copying the Canvas class and making the constructor public.
>
> Is there a better way to do this?
> If not, what is the reasoning behind it (besides that it might not be
> supported)?
>
> I am using version 2.4.0.rc1.
>
> Thanks,
> Julian

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Create Canvas widget from CanvasElement

2011-08-11 Thread Tomasz Gawel
i suppose it's a bug . in majority of widgets constructor with Element
argument is protected.
even a comment in source code of canvas it should be protected not
private:

  /**
   * Protected constructor. Use {@link #createIfSupported()} to create
a Canvas.
   */
  private Canvas(CanvasElement element) {
setElement(element);
  }

i think you should raise the issue in gwt-contributors group.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Create Canvas widget from CanvasElement

2011-08-11 Thread Julian
I want to wrap a CanvasElement ( in HTML) in an Canvas widget.

Many widgets (e.g. Label) have a static method SomeWidget.wrap(Element) for 
wrapping an existing DOM element.
I imagine Canvas does not feature such a method because not all browser 
support  and therefore the user should be forced to go 
through createIfSupported().

Unfortunately the constructor in Canvas is private, which means that Canvas 
can not be subclassed. (There isn't any constructor available in the derived 
class.)

Code snippets of createIfSupported and the constructor in Canvas:

  public static Canvas createIfSupported() {
// check if canvas is supported; if it is not supported: return null
return new Canvas(element);
  }

  private Canvas(CanvasElement element) {
setElement(element);
  }

I ended up copying the Canvas class and making the constructor public.

Is there a better way to do this?
If not, what is the reasoning behind it (besides that it might not be 
supported)?

I am using version 2.4.0.rc1.

Thanks,
Julian

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/MpcJQFQy4BAJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.