I have a Primefaces 11 page where I want to make a mass change on the database. Reading the data works fine and the updateprocess works also. But because it takes some time I wanted to block the page and show an statusbar so the user knows that something is happening and he sees how long it will approximatly take to finish. But the BlockUI doesn't show up. I have a page that is almost the same and there it is working. But I can't see where the difference is to this page. The xhtml looks like this:
<h:form id="abbauForm">
<div class="card">
<p:growl id="messages" sticky="false" showDetail="true" />
<p:panel id="quelldaten" header="Quelldaten">
<h:panelGrid columns="2" columnClasses="label, value">
<h:outputText value="Auswahl" />
<p:fileUpload label="Datei auswahl" mode="simple" multiple="false" auto="true" allowTypes="/(\.|\/)(xlsx?m?|csv)$/"
invalidFileMessage="nur xls | xlsx | csv | erlaubt" update="messages quelldaten"
listener="#{massenabbauhandler.handleFileUpload}" skinSimple="true" />
<h:outputText value="Ticketnummer" />
<p:inputText value="#{massenabbauhandler.massenabbau.ticket}" required="true" label="Ticketnummer" />
<h:outputText value="Abbaudatum" />
<p:datePicker id="date" value="#{massenabbauhandler.massenabbau.abbaudatum}" required="true" />
<h:outputText value="Abbau Objekt" />
<p:selectOneMenu id="selObject" value="#{massenabbauhandler.massenabbau.abbauObject}" required="true">
<f:selectItems value="#{massenabbauhandler.abbauObjects}" />
</p:selectOneMenu>
<h:outputText value="Spalte mit Hostnamen" />
<p:selectOneMenu id="hostCol" value="#{massenabbauhandler.massenabbau.hostCol}" required="true">
<f:selectItems value="#{massenabbauhandler.posCols}" />
</p:selectOneMenu>
<p:commandButton id="abbauBtn" value="Abbau" icon="pi pi-caret-right" actionListener="#{massenabbauhandler.startAbbau}"
disabled="#{massenabbauhandler.notUploaded}" />
</h:panelGrid>
</p:panel>
<p:panel header="Importdaten" id="dataPanel">
<p:staticMessage severity="info" summary="INFO" detail="#{massenabbauhandler.abbauStep}" style="width: 100%" />
</p:panel>
<p:blockUI block="abbauForm:quelldaten" trigger="abbauForm:abbauBtn" />
</div>
</h:form>
I have minimalized the BlockUI to a minimum because it didn't work. The startAbbau() function looks like this:
public void startAbbau() throws InterruptedException {
FacesMessage msg = new FacesMessage("Abbau läuft");
FacesContext.getCurrentInstance().addMessage(null, msg);
setStartBlocked(true);
PrimeFaces.current().ajax().update("abbauForm:quelldaten");
setInProgress(0);
MassenabbauDbHandler madh = new MassenabbauDbHandler(massenabbau);
Thread t = new Thread(madh);
t.start();
do {
Thread.sleep(3000);
setInProgress(madh.getStatus());
} while (t.isAlive());
setInProgress(100);
abbauStep = madh.getReturnMsg();
msg = new FacesMessage("Erfolgreich abgebaut.");
FacesContext.getCurrentInstance().addMessage(null, msg);
PrimeFaces.current().ajax().update("abbauForm:dataPanel");
}
I've noticed that the first and the last message of the function are shown at the end of the function. I can't see why the blockUI isn't shown.