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.
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.
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.