Nov
02
2008

Nice-looking tooltips and popup menus for Google Maps with GWT

For all who love the Google Web Toolkit (GWT), the nice-looking GUI components of GXT (the GWT-version of ExtJs) and Google Maps, I’ve started a google code-project that integrates the tooltips and popup menus of GXT into the GWT version of Google Maps:

http://code.google.com/p/gwt-maps-gxt/

The screenshot shows a tool tip that ist attached to the standard Google Maps marker (the mouse pointer is missing), popup menus will come soon:

The java code of the sample:

package com.claudiushauptmann.gwt.maps.gxt.samples.client;

import com.claudiushauptmann.gwt.maps.gxt.client.MarkerTip;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.control.LargeMapControl;
import com.google.gwt.maps.client.geom.LatLng;
import com.google.gwt.maps.client.overlay.Marker;
import com.google.gwt.user.client.ui.RootPanel;

public class GwtMapsGxt_Sample implements EntryPoint {
	private MapWidget mapWidget;
	private Marker  marker;
	private MarkerTip markerTip;

	public void onModuleLoad() {
		mapWidget = new MapWidget();
		mapWidget.setCenter(LatLng.newInstance(48.136559, 11.576318), 13);
		mapWidget.setWidth("100%");
		mapWidget.setHeight("100%");
		mapWidget.addControl(new LargeMapControl());
		mapWidget.setContinuousZoom(true);
		mapWidget.setScrollWheelZoomEnabled(true);
		RootPanel.get().add(mapWidget);

		marker = new Marker(mapWidget.getCenter());
		mapWidget.addOverlay(marker);

		markerTip = new MarkerTip(mapWidget, marker);
		markerTip.setTitle("Marienplatz");
		markerTip.setDescription("Marienplatz is a central square in the"
				+ " city center of Munich, Germany since 1158.<br/>"
				+ " In the Middle Ages markets and tournaments were held in this"
				+ " city square. The Glockenspiel in the new city hall was inspired"
				+ " by these tournaments, and draws millions of tourists a year.");
	}
}

2 Comments »

  • Hello, I really love your example and I would like to use gwt-maps with a project….however, I was wondering if it is compatible with java 1.4 ….. I hope it is, ‘coz if not it would really be a waist.
    Waiting for your reply!
    Nina

    Comment | February 9, 2009
  • Claudius Hauptmann

    Hi Nina,
    do you want to use GWT 1.4.62 or Java 1.4?
    http://code.google.com/p/google-web-toolkit/downloads/list?can=1&q=&colspec=Filename+Summary+Uploaded+Size+DownloadCount

    I tested gwt-maps-gwt with Java 1.4 and GWT 1.4.62 got this Problem:
    Loading module ‘com.claudiushauptmann.gwt.maps.gxt.samples.GwtMapsGxt_Sample’
    Loading inherited module ‘com.google.gwt.maps.GoogleMaps’
    The problem ist that the current google maps wrapper depends on GWT 1.5 and as far as I know, GWT depends on Java 1.5

    Comment | February 10, 2009

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress. Theme: TheBuckmaker