2 Replies Latest reply on Aug 1, 2013 9:36 AM by Dominik Grupp

    Polling of progressBar not started

    Dominik Grupp Newbie

      In the following example an ajax-button can be used to trigger a process via the backing bean. The backing bean is in view scope. The process can be as well triggered automatically by a timer service.


      When using the command button the progress bar is being displayed as expected. The listener is started and calculating a percentage. Once the process is done "pollEnabled" is false and only the "grid" component is rendered again.


      However, when the process is triggered by the timer service and the user navigates to the page which contains the progress bar the polling of the progress bar does not start (only "initial" is being displayed even after the process ended). That is strange since the polling component "polrating" starts and e.g. the "grid" and "processControlTable" components are rendered in the given interval. Just the progress bar is not working as expected.


      How can I solve that? Can the polling for the progress bar only be started via a button on the very same page (as given in the showcase)? If so, why does the polling of the component "polrating" start once the user navigates on the page?


                <a4j:poll id="polrating" interval="2000" enabled="#{bb.pollEnabled}" action="#{bb.incrementPoller}" render="polrating, grid, pb, processControlTable" />


                <h:panelGrid columns="1" id="grid">
                          <a4j:commandButton value="Start" action="#{bb.startAProcess()}" render="polrating, grid, pb" rendered="#{!bb.pollEnabled}">
                                    <a4j:param value="#{!bb.pollEnabled}" assignTo="#{bb.pollEnabled}" />



      <h:form id="progressBarForm">
                <rich:progressBar mode="ajax" value="#{bb.currentValue}" interval="2000" id="pb" enabled="#{bb.pollEnabled}" minValue="0" maxValue="100">
                          <f:facet name="initial">
                                    <h:outputText value="initial" />
                          <f:facet name="finish">
                                    <h:outputText value="finish" />
                          <h:outputText value="#{bb.currentValue} %" />
                          <a4j:ajax event="begin" listener="#{bb.calculatePercentage}" />


      <h:panelGroup id="processControlTable">
                <h:outputText value="Process control table" rendered="#{bb.pollEnabled and not empty bb.processList}" styleClass="paragraph" />
                <rich:dataTable value="#{bb.processList}" var="process" rendered="#{bb.pollEnabled and not empty bb.processList}">
                                    <f:facet name="header">#{msgs.procTableEntryClassName}</f:facet>
                                    <h:outputText value="#{process.owner}" />
        • 1. Re: Polling of progressBar not started
          Michal Petrov Master

          What does the the timer setrvice do? For the progressBar to start sending requests just being enabled isn't enough, the value must be greater than the minValue. If it isn't the initial facet is displayed.

          • 2. Re: Polling of progressBar not started
            Dominik Grupp Newbie

            The timerService does start the same process which otherwise could be started with the command button. In the meantime I rewrote the biggest part of the backing bean and it works. Unfortunately, I cannot say why since I lost the original code.


            Anyway, you stated the progress bar is only sending requests if the value is greater than the minValue which is true according to the documentation. However, in the showcase example the progress bar is being displayed once it is enabled although the currentValue is still 0. So the currentValue is not greater than minValu but nevertheless it is being displayed. How come?


            As well, in the showcase example there is no "setEnabled(false)" e.g. when the currentValue = 100. Why not? How is this set?