Hi Lance,

with exanpe-t5-lib, we provide a such component with markers and HTML 
InfoWindows :
http://exanpe-t5-lib.appspot.com/components/googlemap/example2

If you want to build your own component, you can have a look at the source code 
:
https://github.com/exanpe/exanpe-t5-lib/blob/master/src/main/java/fr/exanpe/t5/lib/components/GMap.java

The JS part (l. 2809) :
https://github.com/exanpe/exanpe-t5-lib/blob/master/src/main/resources/fr/exanpe/t5/lib/components/js/exanpe-t5-lib.js

Laurent.

________________________________________
De : Lance Java [lance.j...@googlemail.com]
Date d'envoi : vendredi 24 février 2012 17:37
À : Tapestry users
Objet : Re: tml parameter rendered into a JavaScript string

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
        }

}

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to