ICEfaces
  1. ICEfaces
  2. ICE-10464

ace:gMap - Add an actionListener when a gMapEvent is triggered

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.3.0.GA_P02, 4.0
    • Fix Version/s: EE-4.0.0.GA, EE-3.3.0.GA_P03, 4.1
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      All

      Description

      Feature Request: Add a way to notify the server when a gMapEvent is triggered.

      Note on this behavior from Art:

      Implement an actionListener on the ace:gMap component that would fire whenever a Google Maps event, registered via ace:gMapEvent, is triggered. The listener method would receive a special event object that would contain a reference to the gmap component object and a reference to the subcomponent that triggered the event, in this case a marker.

      In rough terms, it would work like this:

      <ace:gMap eventListener="#{bean.gMapEventListener}" .... >
              <ace:gMapMarker latitude="0" longitude="0">
                  <ace:gMapEvent eventType="click" scriptToUse="/* client-side code */"/>
              </ace:gMapMarker>
      </ace:gMap>

      public void gMapEventListener(GMapEvent event) {
          event.getGMap();
          event.getComponent();
          event.getType();
      }

      This way, it would be necessary to only write one listener method and it wouldn't be necessary to write additional javascript code to send the request to the server.

        Activity

        Arran Mccullough created issue -
        Ken Fyten made changes -
        Field Original Value New Value
        Fix Version/s 4.1 [ 11375 ]
        Fix Version/s EE-3.3.0.GA_P03 [ 11572 ]
        Ken Fyten made changes -
        Assignee Arturo Zambrano [ artzambrano ]
        Ken Fyten made changes -
        Assignee Priority P2 [ 10011 ]
        Hide
        Arturo Zambrano added a comment -

        r43999: added server-side listener to ace:gMapEvent in the 3.3 EE maintenance branch.

        The final approach changed from the original idea, to make it more convenient and usable. Instead or registering a single listener in the root ace:gMap component, the listener is registered in each individual ace:gMapEvent component. This way, it's not necessary to write code to identify which event component triggered the event.

        Things work this way now:

        <ace:gMap ... > 
                <ace:gMapMarker latitude="0" longitude="0"> 
                    <ace:gMapEvent eventType="click" scriptToUse="/* client-side code */" listener="#{bean.eventListener}" /> 
                </ace:gMapMarker> 
        </ace:gMap> 
        
        	public void eventListener(org.icefaces.ace.event.MapEvent event) {
        		System.out.println();
        		System.out.println("*** ace:gMapEvent listener triggered ***");
        		System.out.println("* ace:gMapEvent component : " + event.getComponent().getClientId());
        		System.out.println("* ace:gMap component : " + event.getGMap().getClientId());
        		System.out.println("* parent component : " + event.getParent().getClientId());
        	}
        

        The code above can be integrated into the /gMap/gMapEvent.jsf test page.

        Show
        Arturo Zambrano added a comment - r43999: added server-side listener to ace:gMapEvent in the 3.3 EE maintenance branch. The final approach changed from the original idea, to make it more convenient and usable. Instead or registering a single listener in the root ace:gMap component, the listener is registered in each individual ace:gMapEvent component. This way, it's not necessary to write code to identify which event component triggered the event. Things work this way now: <ace:gMap ... > <ace:gMapMarker latitude= "0" longitude= "0" > <ace:gMapEvent eventType= "click" scriptToUse= "/* client-side code */" listener= "#{bean.eventListener}" /> </ace:gMapMarker> </ace:gMap> public void eventListener(org.icefaces.ace.event.MapEvent event) { System .out.println(); System .out.println( "*** ace:gMapEvent listener triggered ***" ); System .out.println( "* ace:gMapEvent component : " + event.getComponent().getClientId()); System .out.println( "* ace:gMap component : " + event.getGMap().getClientId()); System .out.println( "* parent component : " + event.getParent().getClientId()); } The code above can be integrated into the /gMap/gMapEvent.jsf test page.
        Ken Fyten made changes -
        Fix Version/s EE-4.0.0.GA [ 11171 ]
        Fix Version/s 4.1 [ 11375 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #44006 Tue Feb 03 17:48:07 MST 2015 art.zambrano ICE-10464 added listener to ace:gMapEvent
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/ace/component/resources/icefaces.ace/gmap/gmap.js
        Commit graph MODIFY /icefaces4/trunk/icefaces/ace/component/src/org/icefaces/ace/component/gmap/GMapEventMeta.java
        Commit graph ADD /icefaces4/trunk/icefaces/ace/component/src/org/icefaces/ace/event/MapEvent.java
        Commit graph MODIFY /icefaces4/trunk/icefaces/ace/component/src/org/icefaces/ace/component/gmap/GMapEventRenderer.java
        Commit graph MODIFY /icefaces4/trunk/icefaces/ace/component/src/org/icefaces/ace/component/gmap/GMapEvent.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #44009 Tue Feb 03 17:52:15 MST 2015 art.zambrano ICE-10464 expanded TLD description
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/ace/component/src/org/icefaces/ace/component/gmap/GMapEventMeta.java
        Hide
        Arturo Zambrano added a comment -

        r44006: committed improvement to the 3.3 EE maintenance branch.

        Show
        Arturo Zambrano added a comment - r44006: committed improvement to the 3.3 EE maintenance branch.
        Arturo Zambrano made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Liana Munroe added a comment -

        Tested with ICEfaces 4 trunk and ee- 3.3.0 maintenance branch r44009. The listener is verified to work but the is a js console error seen in all browsers when activating the listener.
        FF: TypeError: a is undefined
        IE 11: SCRIPT5007: Unable to get property 'addEventListener' of undefined or null reference
        Chrome 39: Uncaught TypeError: Cannot read property 'addEventListener' of undefinedmain.js:17 T.addDomListenergmap.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:8 google.maps.event.addDomListenergmap.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:40 ice.ace.gMap.addEventgmap.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:14 ice.ace.gMap.recreategmap.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:3 ice.ace.gMap.getGMapWrapperVM153:1 (anonymous function)jquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:69 mjquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:69 q.addjquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:74 d.fn.readyjquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:64 d.fn.initjquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:195 h.fn.initjquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:17 d

        Show
        Liana Munroe added a comment - Tested with ICEfaces 4 trunk and ee- 3.3.0 maintenance branch r44009. The listener is verified to work but the is a js console error seen in all browsers when activating the listener. FF: TypeError: a is undefined IE 11: SCRIPT5007: Unable to get property 'addEventListener' of undefined or null reference Chrome 39: Uncaught TypeError: Cannot read property 'addEventListener' of undefinedmain.js:17 T.addDomListenergmap.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:8 google.maps.event.addDomListenergmap.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:40 ice.ace.gMap.addEventgmap.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:14 ice.ace.gMap.recreategmap.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:3 ice.ace.gMap.getGMapWrapperVM153:1 (anonymous function)jquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:69 mjquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:69 q.addjquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:74 d.fn.readyjquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:64 d.fn.initjquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:195 h.fn.initjquery.c.js.jsf?ln=icefaces.ace&v=4_1_0_150204:17 d
        Hide
        Liana Munroe added a comment - - edited
        Show
        Liana Munroe added a comment - - edited Listener functionality was added to /gMapEvent.jsf applications located at: http://dev.icesoft.com/svn/repo/qa/trunk/Regression-Icefaces4/Sparkle/Manual/gMap http://dev.icesoft.com/svn/repo/qa/trunk/Regression-Icefaces2/Sparkle/Manual/gMap
        Liana Munroe made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #44017 Thu Feb 05 15:53:17 MST 2015 art.zambrano ICE-10464 fix to check if parent element exists before invoking Google Maps API
        Files Changed
        Commit graph MODIFY /icefaces4/trunk/icefaces/ace/component/resources/icefaces.ace/gmap/gmap.js
        Hide
        Arturo Zambrano added a comment -

        Committed fix to check if parent element exists before invoking Google Maps API, at revision 44017 to the 4.0 trunk and at revision 44018 to the 3.3 EE maintenance branch.

        The console error was caused precisely because the info window was no longer present when saving the map state in the client.

        Show
        Arturo Zambrano added a comment - Committed fix to check if parent element exists before invoking Google Maps API, at revision 44017 to the 4.0 trunk and at revision 44018 to the 3.3 EE maintenance branch. The console error was caused precisely because the info window was no longer present when saving the map state in the client.
        Arturo Zambrano made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Liana Munroe added a comment - - edited

        Verified ICEfaces 4 trunk, ee-3.3.0 maintenance branch r44022. Tomcat 7, IE 11, 10, 9, 8, FF 34, Chrome 40.
        Note* - when tested with IE 9 the listener did not respond the first time but did work on the 2nd or 3rd attempt. Could be a test machine issue.

        Show
        Liana Munroe added a comment - - edited Verified ICEfaces 4 trunk, ee-3.3.0 maintenance branch r44022. Tomcat 7, IE 11, 10, 9, 8, FF 34, Chrome 40. Note* - when tested with IE 9 the listener did not respond the first time but did work on the 2nd or 3rd attempt. Could be a test machine issue.
        Ken Fyten made changes -
        Fix Version/s 4.1 [ 11375 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: