A new Google Maps Widget for SWT and RAP

Your early Christmas present from EclipseSource: a custom-widget that displays, controls and reacts to a Google-Map. While there have been similar widgets before, this one is the first (as far as I know) that runs in RAP and RCP without any changes.

gmapb 300x210 A new Google Maps Widget for SWT and RAP gmapd 300x167 A new Google Maps Widget for SWT and RAP

[ Download ] (You also need RAP 1.4M4.)

Creating custom-widgets for RAP is no easy task. You need to be familiar not only with Java and JavaScript, but with a lot of RAP’s complex internals as well. It’s a lot of work, even if you simply want to integrate an existing javascript-application or library.

That’s now a lot easier, using the much improved browser-widget. We recently added some missing features, tested different scenarios and fixed known bugs. This makes it an ideal platform to insert javascript-based applications with almost no overhead for the programmer. You simply call JavaScript from Java and vice versa! And the bonus: these custom-widgets can (under certain conditions) also run in RCP, as demonstrated here.

The widget is currently hosted at github, so feel free to check it out, use it in your application or fork it to add your improvements. Also check out Holger Staudachers carousel widget for RAP to see another example.

“Traditional” custom widgets for RAP are by no means obsolete with this, as they still have certain advantages (slightly better performance, themeability, can use rap client components). But for the cases mentioned above, the browser widget can make your life much easier!

Happy Holidays!

3 Responses to “A new Google Maps Widget for SWT and RAP”

  1. Elias says:

    Very Nice!

    By the way: I think that the RAP homepage might benefit from a section that lists available 3rd party widgets (like this, the carousel widget, the widgets from the incubator and sandbox, etc).

    Best regards,
    Elias.

  2. Erik says:

    Very helpful! I tried to expand on your example. I ran into problems when trying to receive click events from the Map. They never seemed to come through. Also it seems with this technique only primitive data types are supported. Is there a way to pass more complex data types?

    Thanks,
    Erik

  3. SWT click events for Browser widgets won’t work. The click goes into the document of the iframe, and is lost for the parent frame where RAP runs in. If you mean the dom-mouse event within the javascript of the widget, that should work.

    You can pass on Arrays with diffrent data types.

3 responses so far

Written by . Published in Categories: EclipseSource News, Planet Eclipse