Creating widgets for use with / without GWT

75 views
Skip to first unread message

Magno Machado

unread,
Dec 5, 2012, 2:02:36 PM12/5/12
to Google-We...@googlegroups.com
I'm creating some widgets and want them to be usable as normal GWT widgets, and also on non GWT apps

It's simply some input boxes with a few input constraints.

What I did untill now is to code them as any gwt widget, and to enable the use on non gwt apps I export some JS functions that take an HTML element and call a method like gwt's TextBox.wrap(Element) on it

Is it the best approach? Is there a way to produce less overhead on the non-gwt scenario?

--
Magno Machado Paulo
http://blog.magnomachado.com.br
http://code.google.com/p/emballo/

Joseph Lust

unread,
Dec 10, 2012, 1:28:13 PM12/10/12
to google-we...@googlegroups.com, Google-We...@googlegroups.com
Have you checked out gwt-exporter yet? It should achieve what you're talking about with a minimal amount of overhead.

Also, when exposing your widgets, I'd suggest using the ClientBundle so that all images/css/resources are included. This way when non-gwt consumers user your widgets, all they need to do is include in their project is the .js tag, rather than also the CSS/Images/resources.

Sincerely,
Joseph

Thomas Broyer

unread,
Dec 11, 2012, 4:41:13 AM12/11/12
to google-we...@googlegroups.com, Google-We...@googlegroups.com


On Monday, December 10, 2012 7:28:13 PM UTC+1, Joseph Lust wrote:
Have you checked out gwt-exporter yet? It should achieve what you're talking about with a minimal amount of overhead.

FYI, gwt-exporter was created by Ray Cromwell back when he worked at/owned TimePedia, for exactly this purpose. You can see it at use in Chronoscope: https://code.google.com/p/gwt-chronoscope/

Magno Machado

unread,
Dec 11, 2012, 6:54:17 AM12/11/12
to google-we...@googlegroups.com
Thanks Joseph for the clientbundle sugestion. Until now, I'm not using any image/css/resources, it's just java[script] code. But in the future it may be useful!

Regarding gwt-exporter, I don't think it will reduce the compiled js size, 


--
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/-/Fi-Tgq2tIiUJ.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Magno Machado

unread,
Dec 11, 2012, 7:23:48 AM12/11/12
to google-we...@googlegroups.com
I've achieved a great code reduction by avoiding gwt widget stuff when compiling as a js library. Basicaly I'm working directly with Element and DOM classes. Each permutation is now ~10kb (Before it was ~20kb)

I'll experiment tuning my module's <inherits>

Currently it just inherits User.gwt.xml, which in turn inherits lots of modules that I don't need, like:
Tree, RichText, History, Animation, etc.
While the compiler do a good job removing unused code, I'm wondering wether those (and other) modules may still leave some "footprints"

Thomas Broyer

unread,
Dec 11, 2012, 7:27:29 AM12/11/12
to google-we...@googlegroups.com


On Tuesday, December 11, 2012 1:23:48 PM UTC+1, Magno Machado wrote:
I've achieved a great code reduction by avoiding gwt widget stuff when compiling as a js library. Basicaly I'm working directly with Element and DOM classes. Each permutation is now ~10kb (Before it was ~20kb)

I'll experiment tuning my module's <inherits>

Currently it just inherits User.gwt.xml, which in turn inherits lots of modules that I don't need, like:
Tree, RichText, History, Animation, etc.
While the compiler do a good job removing unused code, I'm wondering wether those (and other) modules may still leave some "footprints"

Unless they add linkers (depending on what they do) or entry points, no. AFAICT, only com.google.gwt.logging.Logging could have an overhead even if not actually used.
Reply all
Reply to author
Forward
0 new messages