My favorites | Sign in
Logo
                
Search
for
Updated Aug 15, 2009 by Hazem.saleh
mapComponent  

Beside the JSF UIComponent standard attributes

Component Attribute Required Description Default value
longitude false The longitude you wish the map to point to. 30.01
latitude false The latitude you wish the map to point to. 31.14
address false The address you wish the map to point to. If you use this attribute donot longitude or latitude attributes. NA
locationNotFoundErrorMessage false The error message that should appear if the address location doesnot exist. (GClientGeocoder) service not found the address location
width false The width of the map. 500
height false The height of the map. 500
zoom false The zoom value of the map. 11
type false The type of the map. It can be one of the following values (G_NORMAL_MAP, G_SATELLITE_MAP and G_HYBRID_MAP). G_HYBRID_MAP
renderOnWindowLoad false This flag determines whether to render the map on window load. This flag should be set to false if the map is inside a zone that will be updated by Ajax. true
enableDragging false This flag determines whether to support map dragging. true
addStreetOverlay false Setting this flag to true enables the map to work directly with the streetViewPanorama component. false
jsVariable false This flag determines the Javascript variable you want to use for referring to the map. It should unique. Use this attribute if you want to use write additional Javascript code for the map to customize it. NA
showLocationNotFoundMessage (since 1.1.2) false This attribute determines whether to show an error message when the location is not found. false
autoReshape (since 1.1.2) false Setting this flag to true enables the map to be resized to view all of the markers on it. true
enableScrollWheelZoom (since 1.1.3) false Setting this flag to true enables the map to be zoomed on mouse scroll wheel. false


Comment by aerialbear, Oct 27, 2008

The examples show invoking some nice, built-in, javascript functions on markers etc. Where's the documentation on these functions?

Comment by Hazem.saleh, Oct 27, 2008

What is the example url?

Comment by yann.lebarbu, Apr 20, 2009

hi Is it possible to get new longitude and latitude attributes once user move the marker?? Actually, in my project, i need to get these attributes (once fixed by user when moving the marker) to set them into a Bean.

Comment by Hazem.saleh, Apr 21, 2009

server side events are not supported till now.

Comment by cristan.meijer, Jun 10, 2009
Comment by hectorpalmero, Jun 15, 2009

When I use autoReshape attribute I get an attribute not valid error. What am I doing wrong?

This is the line:

<m:map autoReshape="true" height="585px" latitude="30.01" longitude="31.14" width="550px" zoom="12">

Comment by Hazem.saleh, Jun 15, 2009

Please use the latest 1.1.2 snapshot.

Comment by hectorpalmero, Jun 16, 2009

Thanks, I was using the 1.1.1 version, and I updated to the latest, but I forgot re-build.

Thanks

Comment by tobias.manger, Jun 26, 2009

Hi, I am considering the use of gmaps4jsf in one of my projects. So far it looks very promising. In my use case I would like to search for an address and display it with all locations from my database.

Therefore I would need to know whether a location is close to the entered address or not.

Is there a way to calculate this? Or is it possible to get the map boundaries as long and lat data so I can restrict my search this way?

Thanks

Comment by Hazem.saleh, Jun 27, 2009

Hi tobias,

At first please join the GMaps4JSF group so you can follow all of the library updates. You can join the group from here: http://groups.google.com/group/gmaps4jsf-dev

About your question, if you can do this using Google Maps APIs, please direct us to a link and we will support this scenario BUT till now we are not supporting this feature.

BTW, To ask for a new feature, please submit your feature here: http://code.google.com/p/gmaps4jsf/issues/list

Can you also please tell me about your project name (if possible) to add to the wiki list?

Comment by r...@notify.co.uk, Sep 23, 2009

I'm using Seam with RichFaces? and ajax4jsf.

Using the limited Richfaces gmap I am able to get it to refresh with the new latitude and longitude using;

<a4j:support event="onchange" action="#{devicesToTrackBean.getDevicesToTrackCurrentLocation(devicesToTrack)}" oncomplete="map.setCenter(new GLatLng('#{latitude}', '#{longitude}'), 13)" />

However when I try the same refering to the gmapVar of map2;

<m:map mapType="G_NORMAL_MAP" latitude="#{latitude}" longitude="#{longitude}" zoom="13" gmapVar="map2" width="width:100%" height="500px" oninit="init(map2)" id="NOTiFYPiNPOINTmap2">

<m:marker latitude="#{latitude}" longitude="#{longitude}"/> <m:mapControl name="GLargeMapControl" position="G_ANCHOR_BOTTOM_LEFT"/> <m:mapControl name="GMapTypeControl"/> </m:map>

Nothing happens.

How can I refresh my m:map using the a4j:support event="onchange"?

Thanks

Comment by Hazem.saleh, Sep 23, 2009

1. To respond to the various Ajax responses: Just put your map inside a panel component, and in the re-render of the component that initiates the Ajax, put the id of the panel. Example: http://mashups.s43.eatj.com/gmaps4jsf-examples/pages/mashups.jsf;jsessionid=1191A1765C19DB53B92BDB867119D8D3

2. To respond to the client-side events: Just use the <m:eventListener/> component, an example is here: http://mashups.s43.eatj.com/gmaps4jsf-examples/pages/mapEvents.jsf;jsessionid=1191A1765C19DB53B92BDB867119D8D3

Comment by r...@notify.co.uk, Sep 25, 2009

Hazem thanks for that, the reRender on the a4j:support tag solved it. However ....

Whilst I was trying the m:map tag I left the rich:gmap tag in. So am getting two maps one above the other.

If I remove the basic rich:gmap tag the m:map doesn't appear!

Any suggestions?

!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
    xmlns:m="http://code.google.com/p/gmaps4jsf/"
    template="layout/template.xhtml">
    
    <head> 
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />       
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAgiNNSEpcz5q7mruleySC6RRc6qmiA-g9mt16aVfJwib-tiHt_hTRSSSqgVoLBj20zGqtn5m8J6ZtYw" type="text/javascript">
        function refreshMap() {
            alert('refreshMap()')
            map2.setCenter(new GLatLng('#{latitude}', '#{longitude}'), 13)
        }
        </script>
    </head>  
   
    <f:view contentType="text/html"></f:view>
    <ui:define name="body">
    
    <h1>NOTiFY PiNPOiNT</h1>

    <h:form id="mapForm">
     
        <script>
        function refreshMap() {
            alert('refreshMap()')
            map.setCenter(new GLatLng('#{latitude}', '#{longitude}'), 13)
        }
        </script>
        
        <rich:panel style="width:100%; height:100%;">
            <!-- <h:panelGroup> -->
	        
	            <h:panelGrid columns="2">
	                <h:outputLabel for="devicesToTrack">Device to track</h:outputLabel>
	                <h:selectOneMenu id="devicesToTrack" value="#{devicesToTrack}" required="true">
	                
	                    <s:selectItems value="#{devicesToTrackList}" 
	                    var="devicesToTrack" 
	                    label="#{devicesToTrack.vehicleAllocatedTo}"
	                    itemValue="#{devicesToTrack}"  
	                    noSelectionLabel="Please select"/>
	                    <s:convertEntity/> 
	                   
	                    <a4j:support event="onchange" action="#{devicesToTrackBean.getDevicesToTrackCurrentLocation(devicesToTrack)}" reRender="NOTiFYPiNPOINTpanelGrid" />
	                    
	                </h:selectOneMenu> 
	                <rich:message for="devicesToTrack">
	                </rich:message>
	            </h:panelGrid>
	        
	            <h:panelGrid id="NOTiFYPiNPOINTpanelGrid" columns="1" style="width:100%">
                    <m:map 
                        mapType="G_NORMAL_MAP"
                        latitude="#{latitude}" 
                        longitude="#{longitude}" 
                        zoom="13"
                        gmapVar="map"
                        width="width:100%" 
                        height="500px" 
                        oninit="init(map)"
                        renderOnWindowLoad="false"
                        rendered="true" 
                        id="NOTiFYPiNPOINTmap">
                        
                        <m:marker latitude="#{latitude}" longitude="#{longitude}"/>
                        <m:mapControl name="GLargeMapControl" position="G_ANCHOR_BOTTOM_LEFT"/>
                        <m:mapControl name="GMapTypeControl"/> 
                        
                    </m:map> 
                </h:panelGrid>
	        
	            <h:panelGrid columns="1" style="width:100%">
	                <rich:gmap/> 
                </h:panelGrid>
                
            <!-- </h:panelGroup> -->
        </rich:panel>
    </h:form>

    </ui:define>
</ui:composition>

Sign in to add a comment
Hosted by Google Code