// Only one component in the info window -> no tabbing
UIDL paintableUIDL = u.getChildUIDL(0).getChildUIDL(0);
Paintable paintable = client.getPaintable(paintableUIDL);
map.getInfoWindow().open(marker.getLatLng(),
new InfoWindowContent((Widget) paintable));
// Update components in the info window after adding them to
// DOM so that size calculations can succeed
paintable.updateFromUIDL(paintableUIDL, client);
} else {
int tabs = u.getChildCount();
// More than one component, show them in info window tabs
InfoWindowContent.InfoWindowTab[] infoTabs = new InfoWindowContent.InfoWindowTab[tabs];
Paintable[] paintables = new Paintable[tabs];
UIDL[] uidls = new UIDL[tabs];
int selectedId = 0;
for (int i = 0; i < u.getChildCount(); i++) {
UIDL childUIDL = u.getChildUIDL(i);
if (selectedId == 0
&& childUIDL.getBooleanAttribute("selected")) {
selectedId = i;
}
String label = childUIDL.getStringAttribute("label");
UIDL paintableUIDL = childUIDL.getChildUIDL(0);
Paintable paintable = client
.getPaintable(paintableUIDL);
paintables[i] = paintable;
uidls[i] = paintableUIDL;
infoTabs[i] = new InfoWindowContent.InfoWindowTab(
label, (Widget) paintable);
}
map.getInfoWindow().open(marker.getLatLng(),
new InfoWindowContent(infoTabs, selectedId));
// Update paintables after adding them to DOM so that
// size calculations can succeed
for (int i = 0; i < paintables.length; i++) {
paintables[i].updateFromUIDL(uidls[i], client);