I'm a little confused about raphael events and how raphaelgwt relates
raphael shapes with gwt widgets.
I would like to do some drawing in a raphael paper and register/
unregister some events. I'm not interested in widgetize my raphael
shapes. I only want to create a paper, draw some figures and register
some mouse events.
in gwtraphael I see that mouse event to raphael figures are
implemented using gwt widget. I do not fully understand this:
Are each raphaeljs elements a Gwt Widget?
raphaeljs paper is a widget and a drawed circle it is also a (child)
widget?
is it possible to use (and register mouse events) raphaeljs directly,
without referencing gwt widgets?
you said:
> I would suggest that you might be better off using the widget layer of the
> library as it was designed. The whole point is to make it easy to use the
> native Raphael Javascript library with GWT/Java code and libraries.
> Working around that to access the native Javascript directly might be more
> trouble than it's worth.
As you said, the library seems to be designed to work along with gwt widgets. I'm trying to learn best practices for porting existing javascript toolkits to GWT. Because of this and because I need raphael2.0 and work only with native objects for adding no overhead to my drawings I decided to start developing my own raphaeljs porting to GWT. I named it raphael4gwt:
project's page:
http://code.google.com/p/raphael4gwt/
wiki explaining in the last section more about the reasons and relation with your's raphaelgwt:
http://code.google.com/p/raphael4gwt/wiki/MainDocumentation
demo. Can vew examples java source clicking "view java sources"
http://cancerbero.vacau.com/gwt/raphael4gwtGallery/
I started source code by scratch and basing on Raphael 2.0. I think my library, do the same thing as your (lower-layer) RaphaelJS class. Neverthess raphael4gwt will support 100% of raphaeljs API, including event registrarion/unregistrarion, animations, etc. It is based on gwt.client.dom. Support very basic integration with gwt widgets: only a simple widget class that shows a raphael paper (canvas) inside.
Perhaps in a future the two libraries can help each other to bring a defenitly raphaeljs api (well integrated with GWT widgets as yours).
Also, I's surprised why your raphaelgwt library do not support raphael events at the lower layer. I would add a MouseEventListener interface and the jsni methods:
RaphaelJs.Element::click(MouseEventListener)
RaphaelJs.Element::unclick(MouseEventListener)
....
the only supported event type I see is RaphaelJs.Element::drag()
I would like to contribute to gwtraphael with this, since I have already done this in my raphael4gwt, but I would like to know your opinion first.
raphael4gwt is Work in progress (I started it few days ago). But I'm feeling very confortable programming GWT jsni stuff in eclipse and I think I solved the most difficult problems, so I think in a week or two I will have a 100% raphael api finished.
Regards,
--
Sebastian Gurin <sgu...@softpoint.org>