ICEfaces
  1. ICEfaces
  2. ICE-7099

MyFaces causes the GMap component to trigger a recursive full submit when choosing a location from the select menu.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.1-Beta2, 3.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      ICEfaces 2 MyFaces 2
    • Assignee Priority:
      P1

      Description

      When running the Compat Component Showcase under MyFaces 2, the GMap component triggers recursive "full submit" calls if a city is chosen from the drop down menu.

      Once the item has been chosen and the value changed event has fired, the update returns and is applied. My guess is that the script update that comes back and is evaluated is handled differently by MyFaces and results in another full submit. The candidate area may be here (Ice.GoogleMap.submitEvent):

          locateAddress: function(clientId, address) {
              var gLatLng = function(point) {
                  if (!point) {
                      alert(address + ' not found');
                  } else {
                      var gmapWrapper = Ice.GoogleMap.getGMapWrapper(clientId);
                      if (gmapWrapper) {
                          gmapWrapper.getRealGMap().setCenter(point, 13);
                          var marker = new GMarker(point);
                          gmapWrapper.getRealGMap().addOverlay(marker);
                          marker.openInfoWindowHtml(address);
                          gmapWrapper.geoMarker = marker;
                          gmapWrapper.geoMarkerAddress = address;
                          Ice.GoogleMap.submitEvent(clientId, gmapWrapper.getRealGMap(), "geocoder");
                      } else {
                          //FOR IS DEFINED BUT MAP IS NOT FOUND,
                          //LOGGING CAN BE DONE HERE
                      }
                  } //outer if
              }; //function ends here

              var geocoder = Ice.GoogleMap.getGeocoder(clientId);
              geocoder.getLatLng(address, gLatLng);
          },

      Note that adding an address manually to the inputText and hitting Enter does not result in the looping request behaviour.

        Issue Links

          Activity

          Deryk Sinotte created issue -
          Deryk Sinotte made changes -
          Field Original Value New Value
          Salesforce Case []
          Assignee Deryk Sinotte [ deryk.sinotte ]
          Hide
          Deryk Sinotte added a comment -

          Linking to parent MyFaces 2 compatibility JIRA.

          Show
          Deryk Sinotte added a comment - Linking to parent MyFaces 2 compatibility JIRA.
          Deryk Sinotte made changes -
          Link This issue blocks ICE-5868 [ ICE-5868 ]
          Deryk Sinotte made changes -
          Salesforce Case []
          Affects Version/s 2.0.2 [ 10273 ]
          Hide
          Deryk Sinotte added a comment -

          When debugging the network event running under Mojarra, I see two request/responses to the application. The responses only differ in one respect, the first line of JavaScript to eval. In the first response to return, the first line to eval from the request to http://localhost:8080/cs-mo/showcase.jsf is:

          Ice.GoogleMap.locateAddress('iceform:gmap', 'Sao Paulo');

          In the second request to http://localhost:8080/cs-mo/showcase.jsf:

          Ice.GoogleMap.getGMapWrapper('iceform:gmap').getRealGMap().setZoom(13);

          With MyFaces, the first request to http://localhost:8080/cs-my/showcase.jsf returns the locateAddress call:

          Ice.GoogleMap.locateAddress('iceform:gmap', 'Sao Paulo');

          However the second request http://localhost:8080/cs-my/showcase.jsf also contains the locateAddress call:

          Ice.GoogleMap.locateAddress('iceform:gmap', 'Sao Paulo');

          Looking at the GMap class where it decides what to add to the response, the encodeBegin method checks a number of values to see the state:

          if ((isLocateAddress() || !initilized) && (getAddress() != null
          && getAddress().length() > 2))

          { JavascriptContext.addJavascriptCall(context, "Ice.GoogleMap.locateAddress('" + getClientId(context) + "', '" + getAddress() + "');"); initilized = true; }

          else {
          if (isLocatedByGeocoder(context))

          { JavascriptContext.addJavascriptCall(context, "Ice.GoogleMap.getGMapWrapper('" + getClientId(context) + "').getRealGMap().setZoom(" + getZoomLevel() + ");"); }

          else {

          In this case, it's the "initilized" value that is always false due to some subtlety of state-saving. In fact, it appears saveState and restoreState are not called at all when running under MyFaces.

          Show
          Deryk Sinotte added a comment - When debugging the network event running under Mojarra, I see two request/responses to the application. The responses only differ in one respect, the first line of JavaScript to eval. In the first response to return, the first line to eval from the request to http://localhost:8080/cs-mo/showcase.jsf is: Ice.GoogleMap.locateAddress('iceform:gmap', 'Sao Paulo'); In the second request to http://localhost:8080/cs-mo/showcase.jsf: Ice.GoogleMap.getGMapWrapper('iceform:gmap').getRealGMap().setZoom(13); With MyFaces, the first request to http://localhost:8080/cs-my/showcase.jsf returns the locateAddress call: Ice.GoogleMap.locateAddress('iceform:gmap', 'Sao Paulo'); However the second request http://localhost:8080/cs-my/showcase.jsf also contains the locateAddress call: Ice.GoogleMap.locateAddress('iceform:gmap', 'Sao Paulo'); Looking at the GMap class where it decides what to add to the response, the encodeBegin method checks a number of values to see the state: if ((isLocateAddress() || !initilized) && (getAddress() != null && getAddress().length() > 2)) { JavascriptContext.addJavascriptCall(context, "Ice.GoogleMap.locateAddress('" + getClientId(context) + "', '" + getAddress() + "');"); initilized = true; } else { if (isLocatedByGeocoder(context)) { JavascriptContext.addJavascriptCall(context, "Ice.GoogleMap.getGMapWrapper('" + getClientId(context) + "').getRealGMap().setZoom(" + getZoomLevel() + ");"); } else { In this case, it's the "initilized" value that is always false due to some subtlety of state-saving. In fact, it appears saveState and restoreState are not called at all when running under MyFaces.
          Ken Fyten made changes -
          Salesforce Case []
          Assignee Priority P1
          Hide
          Deryk Sinotte added a comment -

          Looks like some recent changes might have fixed this. Not sure what but likely related to proper handling of ViewState values in forms. In any event, the GMap component appears to be working properly now. Resolving as fixed.

          Show
          Deryk Sinotte added a comment - Looks like some recent changes might have fixed this. Not sure what but likely related to proper handling of ViewState values in forms. In any event, the GMap component appears to be working properly now. Resolving as fixed.
          Deryk Sinotte made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Fix Version/s 2.1-Beta2 [ 10294 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Deryk Sinotte
              Reporter:
              Deryk Sinotte
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: