In my code I have a xhmtl page that has a p:poll (primefaces). Every 5 sec it updates the panelMap (my panel). When the map is updated it has to show 3 messages with growl, the problem is that it shows more 3, then I get 6 messages. And I tryied many diff. ways and couldnt resolve.
view
<ui:composition template="/WEB-INF/template/Layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui">
<title>Monitoramento</title>
<f:metadata>
<f:event listener="#{gadoBean.obterPosicaoTag}" type="preRenderView" />
</f:metadata>
<ui:define name="corpo">
<script
src="https://maps.googleapis.com/maps/api/js?key="mykey"
type="text/javascript"></script>
<h:form prependId="false">
<h:panelGrid columns="3">
<p:poll interval="5" listener="#{gadoBean.obterPosicaoTag}"
update="panelMap" />
<p:button value="Adicionar Pasto" outcome="/area/criarArea.xhtml" />
<p:button value="Mudar animal de pasto"
outcome="/propriedade/mudarAnimal.xhtml" />
</h:panelGrid>
<p:panel id="panelMap" header="Monitoramento"
footer="clique sobre o pasto desejado para obter suas informações"
style="margin-top:30px;margin-left:230px;width:700px;max-width:100%;height:450px;max-height:100%">
<p:growl id="growl" showDetail="false" sticky="true" />
<p:gmap id="mapa" center="#{gadoBean.center}" zoom="17"
model="#{gadoBean.mapa}" type="HYBRID"
style="width:862px;height:400px;max-width:100%;max-height:100%">
<p:ajax event="pointSelect"
listener="#{gadoBean.aoSelecionarPonto}" update="growl" />
</p:gmap>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
You have to add a life to your
growl, so that the 3 three first messages disappear before 5 seconds, then whenp:pollupdatespanelMapafter 5 seconds, another 3 messages shows up,life="4500"(4500 milliseconds) :