Export to GitHub

gmaps4jsf - issue #108

marker "onclick" server-side event


Posted on Apr 6, 2010 by Massive Panda

Hi,

Im tring to trigger a server-side event from a mouse-click on a marker: I thought I could use JBoss' a4j library to push the event to the server. Unfortunately it does not work... Any suggestions?

<h:form id="mapForm"> <m:map width="100%" height="500px" address="#{addressBean.address}" zoom="14"> <m:marker address="#{mapBean.currentAddress.string}"> <a4j:support event="onclick" action="#{mapBean.doo}" /> </m:marker> </m:map> >/h:form>

Comment #1

Posted on Apr 14, 2010 by Helpful Kangaroo

The click event is not supported yet on the GMaps4JSF marker. We will support this feature on next versions.

Comment #2

Posted on Apr 14, 2010 by Massive Panda

Comment deleted

Comment #3

Posted on Apr 15, 2010 by Massive Panda

Comment deleted

Comment #4

Posted on Apr 15, 2010 by Massive Panda

Great to hear that! For now, is there any other way to forward an event from within the map / marker to the server? Many thanks for this great framework!

Comment #5

Posted on Apr 18, 2010 by Helpful Kangaroo

Yes,

Check this example: http://www.mashups4jsf.com/gmaps4jsf-examples/pages/markersServerSideEvents.jsf

Comment #6

Posted on Apr 18, 2010 by Massive Panda

In this example I actually have to change position of the marker, meaning dragging it. I don't want to move it, I just want to tell the server that one marker has been selected by the user, in oder to show further information on the page concerning this marker.

Comment #7

Posted on Dec 3, 2010 by Helpful Kangaroo

Comment deleted

Comment #8

Posted on Dec 3, 2010 by Helpful Kangaroo

(No comment was entered for this change.)

Comment #9

Posted on Jan 21, 2011 by Swift Wombat

I need this funcionality too, I tried to do with a javascript function:

function markerSelected(idMarker) { return function(latlng) { document.getElementById('forma:hiddenInput').value = idMarker; document.getElementById('forma:hiddenBtn').click(); }; }

These are the Marker code jsVariable="pap#{papelera.id}">

And this are the jsf components:

The javascript function tries to generate the click event on the commandButton, and the commandButton has an ActionListener in order to show more information abpout this Marker.

My problem with this approach is that Im getting an error 500, and i dont know what is the cause for it:

Estado HTTP 500 -

type Informe de Excepci�n

mensaje

descripci�n El servidor encontr� un error interno () que hizo que no pudiera rellenar este requerimiento.

excepci�n

java.lang.ArrayIndexOutOfBoundsException: 1 com.googlecode.gmaps4jsf.component.map.MapRenderer.decode(MapRenderer.java:87) javax.faces.component.UIComponentBase.decode(UIComponentBase.java:789) javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1031) javax.faces.component.UIForm.processDecodes(UIForm.java:209) javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1026) javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1026) javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1026) javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:540) com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17) com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:94) com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:54) com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:26) com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24) com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:160) com.icesoft.faces.webapp.http.servlet.SessionDispatcher$1.service(SessionDispatcher.java:38) com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19) com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63) com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:55) com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:19) com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23) com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:91) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56)

Could yout help on this please?

Comment #10

Posted on Apr 20, 2013 by Grumpy Ox

Is the 'click' event supported in the current version?

Comment #11

Posted on Apr 20, 2013 by Helpful Kangaroo

You are lucky. it is fixed now in the latest GMaps4JASF 3.0.1 snapshot, now Ajaxified marker onclick actions can work as follows:

      <m:icon imageURL="http://www.google.com/mapfiles/markerA.png"/>                                        
      <f:ajax event="click" listener="#{map.processClickForMarker}" render="firstMarkerStatus"/>

I attached below the latest snapshot of GMaps4JSF 3.0.1.

Attachments

Comment #12

Posted on Apr 20, 2013 by Grumpy Ox

Well, that truly is a professional customer service :). Thanks a lot.

Comment #13

Posted on Apr 20, 2013 by Helpful Kangaroo

U are welcome. Please do me a favor and let me know the project name, company name, URL (if applicable) of the project that uses GMaps4JSF to add to the projects' wiki.

Comment #14

Posted on Apr 20, 2013 by Grumpy Ox

It's just a personal project for tracking my own travels.

Comment #15

Posted on Jul 3, 2013 by Happy Ox

There is another difference between the valueChangeListener (http://www.mashups4jsf.com/gmaps4jsf-examples/pages/markersServerSideEvents.jsp.source) and http://stackoverflow.com/questions/16124933/hselectmanychexkboxs-fajax-event-click-listener-doesnt-fire-and-gives-an). My requirement is the following: I get a marker from an address (cf. http://www.mashups4jsf.com/gmaps4jsf-examples/pages/getMyLocation.jsf). By click to the displayed marker I want to get latitude and longitude of it transferred to my bean. With attribute binding latitude and longitude to the marker it does not work - I do not even get the map displayed. Probably there is fatal conflict between the address attribute and the coordinates, which are null in the start situation:

            <m:marker draggable="true"
                latitude="#{mapAddressSiteBacking.latitude}"
                longitude="#{mapAddressSiteBacking.longitude}">
                <m:htmlInformationWindow
                    htmlText="#{mapAddressSiteBacking.getGoogleAddressString()}" />
                <m:eventListener eventName="dragend" jsFunction="markerDragHandler" />
                <f:ajax event="click" listener="#{mapAddressSiteBacking.read()}"
                    render="#{mapAddressSiteBacking.renderForms}" />
            </m:marker>

Does anyone have an idea how to achieve that. Thanks in advance

Chris

Status: Fixed

Labels:
Type-Defect Priority-Medium