Re: Possible Lifecycle processing issue

11 views
Skip to first unread message

Hazem Saleh

unread,
May 7, 2013, 6:35:52 PM5/7/13
to gmaps4jsf-dev
What is the Java code in your JSF Action method?


On Tue, May 7, 2013 at 11:04 PM, Daniel Dausch <d.dau...@gmail.com> wrote:
I am writing functionality similar to getMyLocation in the demo. The added value is that I am showing locations (based on internal data) that is within a certain distance from the location entered. The data table and map are rerendered each time a new location is entered. I can continue to enter different addresses and it refreshes the data table and map just fine. However, as soon as I add a marker component to the map there seems to be a problem. The first time is OK but then the second time it is getting the location from the first location - almost like the lifecycle is getting messed up. Any thoughts? Here is my current source code with the marker added.
 

<h:form id="form2">

<h:panelGrid columns="2">

<h:outputText value="Enter your address like 'Boston, MA' :"/>

<h:inputText id="txtAddress" value="#{propertyBean.address}"/>

</h:panelGrid>

<a4j:commandButton value="Get my location on the map" action="#{propertyBean.search}"

render="myTable2,targetMap" limitRender="true">

</a4j:commandButton>

<h:panelGrid id="searchMap" columns="2" border="2" cellpadding="5px"

style="horizontal-align:top">

<rich:extendedDataTable id="myTable2" var="place"

value="#{propertyBean.nearbyProps}"

rows="0" width="450px" height="100px">

<rich:column width="150px">

<f:facet name="header">

<h:outputText value="Long Name" />

</f:facet>

<h:outputText value="#{place.property.longAddressName}"/>

</rich:column>

<rich:column width="200px">

<f:facet name="header">

<h:outputText value="Geocoding" />

</f:facet>

<h:outputText value="#{place.property.geocoding}"/>

</rich:column>

<rich:column width="65px">

<f:facet name="header">

<h:outputText value="Distance"/>

</f:facet>

<h:outputText value="#{place.distance}">

</h:outputText>

</rich:column>

</rich:extendedDataTable>

<h:panelGroup id="targetMap">

<m:map id="map2" width="450px" height="375px" autoReshape="true" enableScrollWheelZoom="true"

partiallyTriggered="true" address="#{propertyBean.address}"

locationNotFoundErrorMessage="Location Not Found" rendered="#{propertyBean.mapToBeRendered}">

<m:marker latitude="#{propertyBean.targetPlace.lat}" longitude="#{propertyBean.targetPlace.lon}">

<m:icon imageURL="images/skull.png"/>

</m:marker>

</m:map>

</h:panelGroup>

</h:panelGrid>

</h:form>

--
You received this message because you are subscribed to the Google Groups "gmaps4jsf-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gmaps4jsf-de...@googlegroups.com.
To post to this group, send email to gmaps4...@googlegroups.com.
Visit this group at http://groups.google.com/group/gmaps4jsf-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Hazem Ahmed Saleh Ahmed

Author of JavaScript Unit Testing book:
http://www.amazon.com/dp/1782160620/

Co-author of (The Definitive Guide to Apache MyFaces and Facelets) book:
http://www.amazon.com/-/e/B002M052KY

DeveloperWorks Contributing Author
https://www.ibm.com/developerworks/mydeveloperworks/blogs/hazem/entry/ibm_developerworks_contributing_author?lang=en_us

An Apache committer, IBMer, and a technical speaker

Twitter: http://www.twitter.com/hazems

Hazem Saleh

unread,
May 8, 2013, 12:56:30 PM5/8/13
to gmaps4jsf-dev
Until now, I cannot see the code which adds markers dynamically, Does it exist in
calcPropertiesWithinRadius?

If yes, what is the code behind it?


On Wed, May 8, 2013 at 6:48 PM, Daniel Dausch <d.dau...@gmail.com> wrote:
 Sorry about the duplicate Posts - feel free to delete the other one if you can. The search method for the commandButton is as follows:

    public String search()
    {
        LocationService locationService = GenericServicesFactory.getLocationService();
       
        // reset our Bean attributes
        this.nearbyProps = null;
        this.targetPlace = null;
       
        System.out.println("In search");
        try {
            System.out.println("Get location for address: " + this.getAddress());
       
            Location location = locationService.getLocationFromAddress(this.getAddress());
              
            System.out.println("LatLng for "+ this.getAddress() + " is: " + location.getLatitude() +", " + location.getLongitude());

           
            this.targetPlace = new Property();
            this.targetPlace.setLat(location.getLatitude());
            this.targetPlace.setLon(location.getLongitude());
            this.targetPlace.setPropertyName(this.getAddress());
            System.out.println("In search - name = " + this.targetPlace.getPropertyName());
            System.out.println("In search - lat = " + this.targetPlace.getLat());
            System.out.println("In search - lon = " + this.targetPlace.getLon());
           
            this.calcPropertiesWithinRadius(location.getLatitude(),location.getLongitude());
           
            System.out.println("Number of Nearby Props: " + nearbyProps.size());
           
        }
        catch (Exception e) {
            e.printStackTrace();
            System.out.println("Unable to get the location from the address ...");
        }       
     
    return "success";

   
    }


--
You received this message because you are subscribed to the Google Groups "gmaps4jsf-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gmaps4jsf-de...@googlegroups.com.
To post to this group, send email to gmaps4...@googlegroups.com.
Visit this group at http://groups.google.com/group/gmaps4jsf-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hazem Saleh

unread,
May 8, 2013, 7:20:33 PM5/8/13
to gmaps4jsf-dev
To be honest with you, the actual problem is still not clear to me. In order to understand it correctly, Let's create one page (which uses one managed bean) that can replicate the problem.

Do not forget to mention which version of GMaps4JSF are you using? Which JSF version? What is the web container you are using and which version? What is the expected and the un-expected scenario in details in order to help you.

Please open this request as a task in the issue management tool below so that myself or any team member can check and provide you with some help:
http://code.google.com/p/gmaps4jsf/issues/list



On Wed, May 8, 2013 at 10:55 PM, Daniel Dausch <d.dau...@gmail.com> wrote:
The marker is embedded in the XHTML file so it is not added dynamically. There are no issues with the code in the xhtml when there are no makers utilized. My ultimate goal is to utilize markers of course. When I add the marker back to the xhtml source file that is when i start seeing the issue with the second time thru.
--
You received this message because you are subscribed to the Google Groups "gmaps4jsf-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gmaps4jsf-de...@googlegroups.com.
To post to this group, send email to gmaps4...@googlegroups.com.
Visit this group at http://groups.google.com/group/gmaps4jsf-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages