按进度条显示分钟进度

时间:2014-10-02 11:50:55

标签: jsf jsf-2 primefaces

我想使用primefaces progress bar来显示用户输入的特定持续时间:

public Integer getProgress() {       
    if(progress == null) {          
        progress = 0;      
    }        else {          
        progress = progress + (int)(Math.random() * 35); //I giess that is now true for the example of 60 min
        if(progress > 100)          
            progress = 100;        }          
    return progress;  
}

这就是我的ProgressView在Moment中的样子。任何建议如何更改进度条以显示例如60分钟的持续时间?

感谢您的回答!

1 个答案:

答案 0 :(得分:1)

只需将进度条上的value属性绑定到支持bean中的progress,并将interval属性设置为合适的属性(默认为300秒)

<p:progressBar id="progressBarClient" value="#{bean.progress}" interval="10" widgetVar="pbClient" style="width:300px"/>

参考