-
1. Re: Richfaces Gmap component sources
sergeysmirnov Jun 8, 2007 5:51 AM (in response to frozone)implementing gmap function in javascript is a way how you need to work with rich:gmap component. So, I am not quite understand what is your problem and how the source (of what?) might help
-
2. Re: Richfaces Gmap component sources
frozone Jun 8, 2007 6:53 AM (in response to frozone)Hi Sergey,
thanks for your quick answer.
I'll try to explain my problem another way. We've got a myFaces Programm running and want to integrate some googleMaps functionality. But we need to draw rectangles or bounding boxes into the gmap. As far as I can see, these function ist not supported yet. Is there any tutorial on how to work with the gmap component?
Another thing is, when I try to add the tld to the web.xml it is not recognized. So I can't use it in the jsp files.
Thanks in advance!
Cliff -
3. Re: Richfaces Gmap component sources
sergeysmirnov Jun 8, 2007 7:32 AM (in response to frozone)Use the standard google map documentation to do what it is possible with google map:
http://www.google.com/apis/maps/documentation/
Use gmapVar attribute to define the javascript variable you will use to manipulate with map
Use oninit attribute to initiate some code when the map is loaded on the page (if it needs)
http://livedemo.exadel.com/richfaces-demo/richfaces/gmap.jsf is the example of usage. Everything that allows in the Google map itself is possible to use with rich:gmap -
4. Re: Richfaces Gmap component sources
frozone Jun 8, 2007 9:40 AM (in response to frozone)hi Sergey,
thanks once again for your answer. Perhaps I should post some Code.<rich:gmap id="smallMap" binding="#{geocoderBean.map}"/>
is how I create the map. In my Bean I gotpublic void setMap(final HtmlGmap map) { if (this.map == null) { this.map = map; this.map.setGmapVar(CliffGeocoderBean.MAP_GMAP_VAR); this.map.setZoom(CliffGeocoderBean.MAP_ZOOM_INITIAL); this.map.setStyle(CliffGeocoderBean.MAP_STYLE); this.map.setGmapKey(this.getGmapKey()); this.map.setLat(CliffGeocoderBean.MAP_LATTIDUDE_INITIAL); this.map.setLng(CliffGeocoderBean.MAP_LONGTIDUDE_INITIAL); this.map.setMapType(CliffGeocoderBean.MAP_TYPE_INITIAL); this.map.setShowGMapTypeControl("false"); this.map.setShowGLargeMapControl("false"); } else { this.map = map; } }
The code works fine and a gmap is shown
Now when I try to access the map in JS with map.setCenter(..) I get an error, that map is not defined. That's the problem I can't cope with. Perhaps I just need one small hint or an example. I already had a look at the richfaces-demo. But did not get any further...
Hoping once again for your help!
Thanks
Cliff -
5. Re: Richfaces Gmap component sources
sergeysmirnov Jun 8, 2007 10:08 AM (in response to frozone)Good to know you have a progress. Very important about this component - it is initiated on page load. I.e. you cannot access to the gmap var before the page is loaded.
For example, you can say just:<script> map.setCenter(..); </script>
However, you can NOT say:<button onclick="map.setCenter(..);" />
If it is important to run some code at the beginning, use oninit:<rich:gmap ..... oninit="initMap()" /> <script> ... function initMap() { map.setCenter(..); } </script>
-
6. Re: Richfaces Gmap component sources
frozone Jun 8, 2007 10:43 AM (in response to frozone)Hi Sergey,
hopefully you mean the other way around...
This does not work...<script> map.setCenter(..); </script>
whereas this works fine...<button onclick="map.setCenter(..);" />
So I managed to create some Buttons, which are able to manipulate the map. But I need to have script running after the map has loaded. OnInit() ist not supported by the latest TLD. So that's the problem. Do you know how I can run JS after the page has been loaded?
Regards
Cliff -
7. Re: Richfaces Gmap component sources
sergeysmirnov Jun 8, 2007 10:52 AM (in response to frozone)It was a way to invoke the init code in the previous version/ However, I highly recommend you to use the current version - 1.1.1 . See : http://jboss.com/index.html?module=bb&op=viewtopic&t=110267
-
8. Re: Richfaces Gmap component sources
frozone Jun 11, 2007 11:57 AM (in response to frozone)Hi Sergey,
Sorry for my late answer. I was not at home the whole week-end. today I tried to fix my problem for about eight hours. I really got stucked. What I want is to add a Button onto the Gmap wich is clickable.
I still got the problem, that I can't handle with the map-variable as long as the map is not loaded. And it is loaded at the very last component. So there is no chance for me to add a button next to the zoom button for example, because I can not interact with the map before page load.
Do you have any idea or can provide me some code?
Thanks once again!
Cliff -
9. Re: Richfaces Gmap component sources
javatwo Jun 12, 2007 12:39 PM (in response to frozone)Recently I am also looking at GMap. Can the GMap accept street address/zip code instead of (Lattitude,Longitude)? 99% people including me does not know the (Lattitude,Longitude) from an address. :) I believe I miss some very basic things.