It seems I'm having troubles explaining what it is I'm trying to do. I need
an implementation for generateInfoWindowHtml() in the code below.

@Import(library="mygooglemap.js")
public class GoogleMap {
        @Inject
        JavaScriptSupport jsSupport;

        @Parameter(required=true)
        RenderCommand infoWindow;

        @Parameter(required=true)
        List<GoogleMapMarker> markers;

        @Parameter(required=true)
        double centerLatitude;

        @Parameter(required=true)
        double centerLongitude;

        @Parameter(required=true)
        int zoom;


        @SetupRender
        void setupRender() {
                JSONObject mapInitializer = createInitializerJsonObject();
                jsSupport.addScript("initGoogleMap(%s)", mapInitializer);
        }

        private JSONObject createInitializerJsonObject() {
                JSONObject init = new JSONObject();
                JSONArray markerInits = new JSONArray();
                for (GoogleMapMarker marker : markers) {
                        JSONObject markerInit = new JSONObject();
                        markerInit.put("latitude", marker.getLatitude());
                        markerInit.put("longitude", marker.getLongitude());
                        markerInit.put("infoWindowHtml",
generateInfoWindowHtml(marker));
                }
                init.put("centerLatutude", centerLatitude);
                init.put("centerLongitude", centerLongitude);
                init.put("zoom", zoom);
                init.put("markers", markerInits);

                return init;
        }

        private String generateInfoWindowHtml(GoogleMapMarker marker) {
                // Use tapestry's template engine to generate html using
marker and infoWindow
        }

}

Reply via email to