Affichage d'une GoogleMaps avec points correspondant à des agents
Bonjour,
J'aimerais afficher une datatable contenant une liste d'agents sélectionnables, puis après validation, que ces agents apparaissent sur une carte.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <p:dataTable id="datalist" value="#{agentController.items}" var="item" >
<f:facet name="header"></f:facet>
<p:column sortBy="#{item.idAgent}" headerText="#{bundle.ListAgentTitle_idAgent}" style="width: 50px">
<h:outputText value="#{item.idAgent}" />
</p:column>
<p:column sortBy="#{item.nom}" headerText="#{bundle.ListAgentTitle_nom}" style="width: 50px">
<h:outputText value="#{item.nom}" />
</p:column>
<p:column headerText="action a faire">
<h:commandLink id="viewButton" action="#{DrMapBean.getId}">
<h:outputText value="view map"/>
<f:param name="id" value="#{item.idAgent}"/>
</h:commandLink>
</p:column> |
Le bean
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| public final class DrMapBean implements Serializable {
private MapModel advancedModel;
private Marker marker;
public String getId() {
FacesContext context;
context = FacesContext.getCurrentInstance();
Map map = context.getExternalContext().getRequestParameterMap();
String title1;
title1 = (String) map.get("title");
return title1;
}
public DrMapBean() throws SQLException {
advancedModel = new DefaultMapModel();
ResultSet rs;
rs = connexion_à_mysql.interogerAbout( "select * from agent where IdAgent="+getId()+"; ");
LatLng coord;
coord = new LatLng(rs.getFloat("LatitudeAgent"), rs.getFloat("LongitudeAgent"));
String Name;
Name = rs.getString("Nom");
advancedModel.addOverlay(new Marker(coord, Name, "http://maps.google.com/mapfiles/ms/micons/blue-dot.png"));
} |
Quelqu'un saurait-il m'indiquer comment faire ?
Merci d'avance pour votre aide.