This might be of help for users looking to integrate Google Maps with SmartGWT.
What's neat is that we can display SmartGWT widgets inside the maps info window. If only I could attach images to the post. :(
What's neat is that we can display SmartGWT widgets inside the maps info window. If only I could attach images to the post. :(
Code:
public class HelloWorld implements EntryPoint {
/**
* This is the entry point method.
*/
public void onModuleLoad() {
RootPanel.get().add(getViewPanel());
}
private MapWidget getMap() {
MapWidget map = new MapWidget();
map.setSize("500px", "300px");
map.addControl(new LargeMapControl());
map.getInfoWindow().open(map.getCenter(),
new InfoWindowContent(getMapInfoWindow()));
return map;
}
public Canvas getViewPanel() {
HLayout hLayout = new HLayout(5);
hLayout.addMember(new Label("Dummy Label in a Horizontal Layout"));
// Add the map to the HTML host page
hLayout.addMember(getMap());
return hLayout;
}
private Canvas getMapInfoWindow() {
final TabSet topTabSet = new TabSet();
topTabSet.setTabBarPosition(Side.TOP);
topTabSet.setWidth(200);
topTabSet.setHeight(100);
Tab tTab1 = new Tab("Blue");
HTMLPane tab1Pane = new HTMLPane();
tab1Pane.setContents("Hello. This sample shows a google map widget taking part in a SmartGWT Layout");
tTab1.setPane(tab1Pane);
Tab tTab2 = new Tab("Green");
HTMLPane tab2Pane = new HTMLPane();
tab2Pane.setContents("Google Maps InfoWindow can display SmartGWT Widgets");
tTab2.setPane(tab2Pane);
topTabSet.addTab(tTab1);
topTabSet.addTab(tTab2);
return topTabSet;
}
}
Comment