I found the solution in this page: http://answers.axonivy.com/questions/16 ... ser-dialog
The problem is that I show the progress bar, but always is "0%". In the javascript function never enter.
This is my XHTML:
Code: Select all
<h:form id="formAllocate">
<p:panel id="panel" header="Realtime ProgressBar">
<p:commandButton id="btn" value="Start"
actionListener="#{scheduleMB.startLongRunningProcess}">
</p:commandButton>
</p:panel>
<p:blockUI block="panel" trigger="btn">
<p:progressBar widgetVar="progressBar" style="width:300px"
labelTemplate="{value}%">
</p:progressBar>
<span id="msg"></span>
</p:blockUI>
</h:form>
<p:socket channel="/realtime" onMessage="handleProgress"></p:socket>
<script type="text/javascript">
function handleProgress(progressJson) {
alert('begin');
var progressData = eval("(" + progressJson + ")");
progressBar.setValue(progressData.progress);
$("#msg").text(progressData.msg);
}
</script>
Code: Select all
public void startLongRunningProcess(){
EventBus eventBus = EventBusFactory.getDefault().eventBus();
eventBus.publish("/realtime", "{ 'progress' : 10, 'msg' : 'Extract data'}");
list =
getAuxService().findList(userSelected, initDate2,
endDate2);
}
Code: Select all
<!-- Primefaces PUSH -->
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
Code: Select all
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.roboguice</groupId>
<artifactId>roboguice</artifactId>
<version>2.0</version>
</dependency>
What I'm doing wrong???
Thx for the help and answer.