erickgugo / gmaps4jsf

Automatically exported from code.google.com/p/gmaps4jsf
0 stars 0 forks source link

refresh counter without repainting the entire map #207

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I want to repaint the markers every 1 minute without having to paint the map 
again.

<?xml version="1.0"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
        xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
        xmlns:m="http://code.google.com/p/gmaps4jsf/"
         xmlns:a4j="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich"
        template="../../include/template/template.xhtml">
    <ui:define name="content">
        <script type="text/javascript"
             src="https://maps.googleapis.com/maps/api/js?sensor=true">
        </script> 
        <h:outputScript>
        function customFilter(subString, value) {
            if (subString.length >= 1) {
                if (value.indexOf(subString) != -1)
                    return true;
            } else
                return false;
        };
        </h:outputScript>
        <h:outputStylesheet>
            .autoCompleteWidth50 {
                width:300px !important;
            }
              .rf-au-lst-scrl {
                width:300px !important;
                height:300px;
                max-height: 500px;
                      min-height: 300px;
            }
            .autoCompletePopupHieght {
                width:300px !important;
                height:300px !important;
            }
         </h:outputStylesheet>
        <h:form>
            <a4j:poll id="poll" interval="6000" render="mapPanel" action="#{mapaBean.load}" />
        </h:form>
        <h:form id="form1">
            <h:panelGrid columns="2">
                <rich:autocomplete id="idBusqueda" 
                    value="#{mapaBean.idCruce}" 
                    fetchValue="#{cruce.ubicacion}" 
                    mode="ajax" minChars="2" 
                    autofill="false" clientFilterFunction="customFilter"
                    autocompleteMethod="#{mapaBean.autocomplete}" 
                    autocompleteList="#{mapaBean.listaCruce}"
                    var="cruce"
                    layout="list"
                    inputClass="autoCompleteWidth50"
                    popupClass="autoCompletePopupHieght"
                    selectFirst="false"
                    valueChangeListener="#{mapaBean.cambioValorAutoComplete}">
                    <h:outputText id="idUbicacion" value="#{cruce.ubicacion}"/>  
                </rich:autocomplete>
                <h:commandButton value="Buscar" action="#{mapaBean.buscar}" />
            </h:panelGrid>
            <h:panelGroup  id="mapPanel" >
                <m:map id="mapa" width="800px" height="300px" 
                       latitude="#{mapaBean.latitudMapa}" 
                       longitude="#{mapaBean.longitudMapa}" 
                       zoom="#{mapaBean.tamanoMapa}" 
                       jsVariable="map1"
                       partiallyTriggered="true"
                       renderOnWindowLoad="false"
                      >
                    <a4j:repeat id="punto" var="loc" value="#{mapaBean.listaPuntos}" rendered="true"  >
                        <m:marker id="idMarca" latitude="#{loc.latitud}" longitude="#{loc.longitud}" jsVariable="marker1">
                            <m:icon imageURL="#{loc.icono}" /> 
                            <m:htmlInformationWindow htmlText="#{loc.informacion}"  />
                        </m:marker>
                    </a4j:repeat>
                </m:map>
            </h:panelGroup>
    </h:form>
    </ui:define>
</ui:composition>

Original issue reported on code.google.com by rodrigo....@clamber.cl on 27 Feb 2015 at 8:37