aspose file tools*
The moose likes JSF and the fly likes Having issues reRendering a map when a rich:tree node is clicked on(SOLVED) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Having issues reRendering a map when a rich:tree node is clicked on(SOLVED)" Watch "Having issues reRendering a map when a rich:tree node is clicked on(SOLVED)" New topic
Author

Having issues reRendering a map when a rich:tree node is clicked on(SOLVED)

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

Im using a4j:repeat to dynamically generate markers on a map. I did this with the marker:



the value of that repeat tag is just a List filled with Objects. lat and lng are two variables in each Object, which is what i use for the latitude and longitude attributes in the m:marker tag.

Is it OK to use a List of Objects, or do I need to do something else like using a list of String values instead of Objects?

The other potential problem is how this List gets loaded with values. I know it is getting loaded with the correct values, because I have System.out lines of code to make sure each time the method gets called. On the left side of my page a I have a rich:tree, and the nodeSelectListener is what loads the List with values. Then I set the reRender attribute to "map", which is the id attribute on the m:map tag. <m:map width="1000px" height="750px" zoom="2" id="map">

So essentially it seems when someone clicks on the node in the rich:Tree, it should call the emthod to load the List with values, which it does just fine, but then it needs to reRender the map, but when the map gets reRendered all I see is a blank white page. If it helps, here is the rich:tree tag. Maybe I have something wrong there?



Unfortunately I only have till about 330 pm tomorrow to get this working, so I am posting this to you at 5am so I can go to bed and hope someone can spot my issue

Thanks


edit - solution I looked more clocely at the java doc for this map code, and it turns out all I needed to do was to add this to the m:map tag - renderOnWindowLoad="false"

Now it looks like this:



Now when you click on a project from the rich:tree, it reRenders the map with the markers placed on the coordinates they have.


True wisdom is in knowing you know nothing - Socrates
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

Oh goodie. GitRDun/UndethTheGun. We get more quality software that way.

The actual interactions of Java objects and JSF views (EL) is done using BeanUtils and so follows the BeanUtil rules. That usually means that any object that can be converted to or from a String is OK in an EL expression. However, in some of the RichFaces objects I've seen unhappy results.

When you get your blank page, wait about 30 seconds and then click the "Back" button. If the map appears (you may have to click "Forward"), you've run into the exact same problem I've been fighting for the last year or so (obviously that project didn't have a deadline). It's a known issue with Google Maps where apparently the internal structures aren't being set up with rigorous regard to synchronicity.

Unfortunately, I don't know of a cure. And Google doesn't seem to be working very hard on one.


Customer surveys are for companies who didn't pay proper attention to begin with.
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

I got it, I put the solution as an edit in my original post if you want to see what I had to do.

I'm not using rich:map or rich:gmap or whatever it is btw Tim, so maybe the map I am using will work for your issue too? It is open source so you can use it freely.

http://code.google.com/p/gmaps4jsf/
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

The RichFaces Google Maps tag didn't exist when I wrote my stuff. I made a custom tag whose primary purpose was to render a map view and connect it to an external JavaScript.

I probably ought to look at some of the newer stuff just in case I can get the page in question to work, although it's the only map in the app that gives me trouble.
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

edit - btw you do not have to get a google map key either, you just use the JARs this guys put on his site. But you still have all the funstionality of a google map like different view types, zooming in and out, centering over a locaton by typing in an address, plus more. Ha I sound like a commercial for this stuff

Here is one of this guys samples that connects the map to java script to pop up a window that tells you the new lat and lng when you drag and drop a marker:



Dunno if that is what you are looking for but there are a ton of examples of his map interacting with java script on that site. After all the help you've given me on this and numerous other threads it would be great if this works for you and I could help you out for once lol
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Having issues reRendering a map when a rich:tree node is clicked on(SOLVED)