emnadridi / gmaps4jsf

Automatically exported from code.google.com/p/gmaps4jsf
0 stars 0 forks source link

ui:repeat not working inside m:map #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a jsf page with:
<m:map...>
 <ui:repeat var="loc" value="${somecollection">
   <m:marker lat="loc.lat" long="loc.long"/>
 </ui:repeat>
</m:map>
2. View the page.
NB: c:forEach does work correctly.
NB2: other facelets tags may not work either.

What is the expected output? What do you see instead?
Expected: List of markers placed on a map.
Actual: Nothing.

What version of the product are you using? On what operating system?
Latest source, Windows XP, Firefox.

Please provide any additional information below.
As there is a work around this is not an important issue. However, jstl 
and facelet tags on the same page do not always cooperate and only one 
style should be used.

Original issue reported on code.google.com by dapoo...@gmail.com on 1 Oct 2008 at 2:13

GoogleCodeExporter commented 9 years ago
ui:repeat doesnot work with map objects, and this is a known issue.

As a walk-around:
You can dynamically create map objects inside your managed bean code.

Original comment by Hazem.sa...@gmail.com on 1 Oct 2008 at 2:58

GoogleCodeExporter commented 9 years ago
I will start working on this issue on the next free time slot.

Original comment by Hazem.sa...@gmail.com on 2 Oct 2008 at 8:04

GoogleCodeExporter commented 9 years ago
Assigned to me.

Dapooley, BTW you can provide a patch if you have some free time to fix this, 
and I
will review.

Thanks!

Original comment by Hazem.sa...@gmail.com on 2 Oct 2008 at 8:05

GoogleCodeExporter commented 9 years ago
:) I'm in the middle of moving house.

Original comment by dapoo...@gmail.com on 8 Oct 2008 at 12:57

GoogleCodeExporter commented 9 years ago
ok, Good Luck then :).

Original comment by Hazem.sa...@gmail.com on 8 Oct 2008 at 1:41

GoogleCodeExporter commented 9 years ago
It's also not working with <t:dataList>.

@Hazem.saleh:
Could you please explain the workaround a little more detailed?
how do i include these map objects within the m:map?

Original comment by robert.m...@gmail.com on 7 Dec 2008 at 4:48

GoogleCodeExporter commented 9 years ago
In the managed bean code:
package nl.ordina.google.backing;

import com.googlecode.gmaps4jsf.component.map.Map;
import com.googlecode.gmaps4jsf.component.marker.Marker;
import com.googlecode.gmaps4jsf.component.eventlistener.EventListener;

public class GoogleBean {
    private Map map;

    public void setMap(Map map) {
        this.map = map;
        map.setLatitude("52.05");
        map.setLongitude("5.11");

        Marker mark = new Marker();
        mark.setLatitude("52.05");
        mark.setLongitude("5.11");
        mark.setJsVariable("office1");
        mark.setId("mark1");
        EventListener event = new EventListener();
        event.setEventName("click");
        event.setJsFunction("marker1ClickHandler");
        mark.getChildren().add(event);
        map.getChildren().add(mark);

        Marker mark2 = new Marker();
        mark2.setLatitude("53.19");
        mark2.setLongitude("6.53");
        mark2.setJsVariable("office2");
        mark.setId("mark2");
        EventListener event2 = new EventListener();
        event2.setEventName("click");
        event2.setJsFunction("marker2ClickHandler");
        mark2.getChildren().add(event2);
        map.getChildren().add(mark2);

    }

    public Map getMap() {
        return map;
    }

}

In the JSP code:
<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:yui="http://code.google.com/p/gmaps4jsf/">
  <jsp:directive.page contentType="text/html;charset=windows-1252"/>
  <body onunload="GUnload()">
    <f:view>
      <f:verbatim>
        <![CDATA[ 
            <script
src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAM7FSGSscPTbXiOt1No2LPR
RKSto2PHtB06oPKyRV-hhKjT8WCBSTy2uiK1M8ViuI9Xm8mMLb7d1aKQ"
             type="text/javascript">
            </script>
        ]]>
      </f:verbatim>
      <af:form id="form">
        <af:panelGroupLayout>
          <f:verbatim>
            <![CDATA[ 
                <script type="text/javascript">
                    function hideMarker() {
                        office1.hide();
                        office2.hide();
                    }

                    function showMarker() {
                        office1.show();
                        office2.show();
                    }

                    function marker1ClickHandler() {
                        alert("You clicked on the headoffice");   
                    } 

                    function marker2ClickHandler() {
                        alert("You clicked on a office");   
                    }

                </script>
             ]]>
          </f:verbatim>
          <af:panelHeader text="GMaps4JSF">
            <input type="button" value="Hide Offices" onclick="hideMarker();"/>
            <input type="button" value="Show Offices" onclick="showMarker();"/>
            <yui:map width="500px" height="500px" zoom="7"
                     binding="#{GoogleBean.map}">
              <yui:mapControl name="GLargeMapControl"
                              position="G_ANCHOR_BOTTOM_RIGHT"/>
              <yui:mapControl name="GMapTypeControl"/>
            </yui:map>
          </af:panelHeader>
        </af:panelGroupLayout>
      </af:form>
    </f:view>
  </body>
</jsp:root>

This code snippet is taken from:
http://biemond.blogspot.com/2008/09/google-maps-for-jsf-gmaps4jsf-in.html

As you notice, Edwin uses the binding attribute to create dynamic map markers.

Original comment by Hazem.sa...@gmail.com on 7 Dec 2008 at 7:06

GoogleCodeExporter commented 9 years ago
Hi,

Actually codes blow:
<yui:map width="500px" height="500px" zoom="7"
                     binding="#{GoogleBean.map}">

uses "binding" attribute which is not valid for "m:map" so it does not working 
for me?

Is there any other way for creating markers dynamically? And also, how can we 
let
user create their own markers so that user can create his/her favorite places?

Thanks.

Original comment by onurrak...@gmail.com on 10 Dec 2008 at 1:31

GoogleCodeExporter commented 9 years ago
I am unable to get this working with a 'dataTable' either.  I am trying to use 
the
binding attribute with Bean.  This works fine without a 'dataTable' however:

Bean Code:

    public Map getMap() {
        Map map = new Map();
        map.setId("map_" + getId());
        map.setWidth("280");
        map.setHeight("220");
        map.setType("G_NORMAL_MAP");
        map.setZoom("14");
        map.setJsVariable("map_" + getId());
        map.setRenderOnWindowLoad("false");
        if (getLatitude() != null && getLongitude() != null) {
            map.setLatitude(getLatitude());
            map.setLongitude(getLongitude());
        } else {
            map.setAddress(getMapAddress());
        }
        return map;
    }

JSP:

<m:map id="map" binding="#{item.location.map}"/>

Exception:

javax.el.PropertyNotFoundException: Target Unreachable, identifier 'item' 
resolved to
null

Can you think of a workaround?

Original comment by smith....@gmail.com on 12 Dec 2008 at 7:01

GoogleCodeExporter commented 9 years ago
Issue 9 has been merged into this issue.

Original comment by Hazem.sa...@gmail.com on 1 Jan 2009 at 7:40

GoogleCodeExporter commented 9 years ago

Original comment by Hazem.sa...@gmail.com on 3 Jan 2009 at 7:02

GoogleCodeExporter commented 9 years ago

Original comment by Hazem.sa...@gmail.com on 3 Jan 2009 at 8:29

GoogleCodeExporter commented 9 years ago

Original comment by Hazem.sa...@gmail.com on 13 Apr 2009 at 5:52

GoogleCodeExporter commented 9 years ago

Original comment by Hazem.sa...@gmail.com on 13 Apr 2009 at 5:54

GoogleCodeExporter commented 9 years ago
Is this the only way to display multiple markers ? can we expect to use an 
attribute 
like m:markers and provide a list of markers to it.

I have to use this functionality in my project so I am looking forward to get 
this 
answer.

Many thanks in advance.

Original comment by deveshsi...@gmail.com on 3 Sep 2009 at 11:04

GoogleCodeExporter commented 9 years ago
Hi,
I've got a question connected with this code: 
http://biemond.blogspot.com/2008/09/google-maps-for-jsf-gmaps4jsf-in.html
Is there any way to add HTMLInformationWindow to a marker?
I tried something like this, but it doesn't work (HTMLInformationWindow doesn't 
show 
up):

Marker mark = new Marker();
[...]
HTMLInformationWindow window = new HTMLInformationWindow();
window.setHtmlText("Test");
mark.getChildren().add(window);
map.getChildren().add(mark);

Thanks in advance.

Original comment by john.pre...@gmail.com on 9 Jan 2010 at 12:07

GoogleCodeExporter commented 9 years ago
@John:

This can work with many ways.

1. You can declare the <m:htmlInfoWindow/> as a child of the <m:marker/>.
2. Or you can use the way you describe but please make sure that you are using 
the
latest snapshot of the library here:
http://gmaps4jsf.googlecode.com/files/gmaps4jsf-1.1.3-SNAPSHOT.jar

Note that when the htmlInfoWindow is added as a children of the marker then it 
will
appear when you click the marker.

Here is an example:
http://mashups.s43.eatj.com/gmaps4jsf-examples/pages/addressableMarkers.jsf

Original comment by Hazem.sa...@gmail.com on 9 Jan 2010 at 12:21

GoogleCodeExporter commented 9 years ago
Thanks for a quick response. Let's say, I don't want to add the htmlInfoWindow 
as a 
children of the marker. In this case I have to set htmlInfoWindows' parameters: 
latitude  and longitude. Does your library provide a method which can return 
these 
values if the address is given? 

Original comment by john.pre...@gmail.com on 9 Jan 2010 at 2:01

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/gmaps4jsf/wiki/htmlInformationWindowComponent

According to the documentation the htmlInformationWindow can work standalone by 
lng
and lat only till now.

Original comment by Hazem.sa...@gmail.com on 9 Jan 2010 at 4:22