java Primefaces 中的视觉“忙”指示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13166721/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 11:43:53  来源:igfitidea点击:

Visual "busy" indication in Primefaces

javajsfjsf-2primefaces

提问by Dmitrii Pisarenko

I have a Primefaces-based application, in which there are some lengthy operations.

我有一个基于 Primefaces 的应用程序,其中有一些冗长的操作。

When such operation is being executed, I want to indicate this somehow (like displaying an hourglass or a message, which appears at the center of the screen).

当执行这样的操作时,我想以某种方式表明这一点(比如显示一个沙漏或一条消息,它出现在屏幕中央)。

What is the easiest way to do this in Primefaces/JSF?

在 Primefaces/JSF 中执行此操作的最简单方法是什么?

回答by rdcrng

I'd recommend doing it with <p:blockUI>. Here's an example:

我建议用<p:blockUI>. 下面是一个例子:

<h:form>
    <p:panel id="content" >
        ...
        <p:commandButton id="longOperation" value="Process" />
    </p:panel>
    <p:blockUI block="content" trigger="longOperation">  
        <p>Here you can customize what appears as the overlay over the blocked content.</p>
        <p:graphicImage value="/images/ajax-loader.gif"/>  
    </p:blockUI>
</h:form>

Take a look at http://www.primefaces.org/showcase/ui/blockUI.jsffor more info.

查看http://www.primefaces.org/showcase/ui/blockUI.jsf了解更多信息。