private String getJsOverlay(Overlay overlay)
{
String jsToRun = overlay.getJSadd(this) + "\n";
if (overlay instanceof Marker)
{
Marker marker = (Marker)overlay;
// if marker has popup and there are no events attached then attach
// default listener
if (marker.getPopup() != null &&
(marker.getEvents() == null || marker.getEvents().length == 0))
{
// add mousedown listener!
marker.addEvent(EventType.mousedown);
}
// add listeners
for (EventType evt : marker.getEvents())
{
jsToRun += getJSinvoke("addMarkerListener('" + evt.name() + "','" +
callbackListener.getCallBackForMarker(marker) + "'," +
marker.getOverlayJSVar() + ")");
}
if (marker.getIcon() != null)
{
// prepend icon stuff
jsToRun = marker.getIcon().getSize().getJSadd() +
marker.getIcon().getOffset().getJSadd() + marker.getIcon().getJSadd() + jsToRun;
}
}
return jsToRun;
}