Hi Lance, in fact, in my sample (Eiffel Tower example), i put html content into properties file but you're right : i agree that this could be easier to directly use block binding parameter or the GMap api support for passing the id of a html element. I'll try to add this feature in the next release.
Tanks for your feedback. Laurent ________________________________________ De : Lance Java [lance.j...@googlemail.com] Date d'envoi : samedi 25 février 2012 11:49 À : Tapestry users Objet : Re: RE : tml parameter rendered into a JavaScript string Hi Laurent, I took a look at your library and from what I can see, it is missing the functionality that I want. It seems that each marker has an info property which is a string containing the text to render in the info window. I would like each marker's info window to contain complex html and I would like to achieve this by passing a block (or perhaps a render command) to the gmap component which will be used to render each marker's info window. I have noticed that the google map marker api supports passing the id of a html element instead of the text content to show for an info window. I think I will explore the option of rendering a hidden div for each marker's info window using a RenderCommand parameter and the MarkupWriter. I will then pass the div id's to the gmap's javascript initializer so that the info window div can be shown when a marker is clicked. Unless, of course, someone can tell me how to use tapestry's templating engine to render strings on the serverside which I can pass to the javascript initializer. I'm thinking that tapestry must be doing this somewhere in order for MultiZoneUpdate to work? On 25 February 2012 06:54, Guerin Laurent <lgue...@sopragroup.com> wrote: > 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 > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org