This example shows how to block the entire page. The entire page can be blocked if
you don't define the "target" attribute.
| Please wait... |
Source
<p:commandButton value="Block this page!" action="#{blockUIController.doSomething}" update="@none"
onstart="PF('blockUIWidget').block()" oncomplete="PF('blockUIWidget').unblock()"/>
<pe:blockUI widgetVar="blockUIWidget" cssOverlay="{opacity:0.5}">
<h:panelGrid columns="2">
<h:graphicImage library="images" name="ajax-loader1.gif"
style="margin-right: 12px; vertical-align: middle;"/>
<h:outputText value="Please wait..." style="white-space: nowrap;"/>
</h:panelGrid>
</pe:blockUI>
@Named
@ViewScoped
public class BlockUIController implements Serializable {
private static final long serialVersionUID = 20130903L;
public void doSomething() {
try {
// simulate a long running request
Thread.sleep(1200);
}
catch (final Exception e) {
// Restore interrupted state...
Thread.currentThread().interrupt();
}
}
}