Author: ppitonak(a)redhat.com
Date: 2010-12-08 04:02:50 -0500 (Wed, 08 Dec 2010)
New Revision: 20446
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/ajaxMode.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/clientMode.xhtml
Log:
https://jira.jboss.org/browse/RFPL-864
* facet complete renamed to finish
* added pause button to client-type progress bar
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/ajaxMode.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/ajaxMode.xhtml 2010-12-08
08:13:40 UTC (rev 20445)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/ajaxMode.xhtml 2010-12-08
09:02:50 UTC (rev 20446)
@@ -80,7 +80,7 @@
rendered="#{richProgressBarBean.buttonRendered}"
style="margin: 9px 0px 5px;" />
</f:facet>
- <f:facet name="complete">
+ <f:facet name="finish">
<h:outputText id="completeOutput" value="Process
Done" />
<br/>
<a4j:commandButton id="restartButton"
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/clientMode.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/clientMode.xhtml 2010-12-08
08:13:40 UTC (rev 20445)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richProgressBar/clientMode.xhtml 2010-12-08
09:02:50 UTC (rev 20446)
@@ -41,25 +41,35 @@
<ui:define name="component">
<script type="text/javascript">
- //<![CDATA[
- var counter = 1;
- var intervalID;
+ //<![CDATA[
+ var counter = 1;
+ var intervalID;
+
function updateProgress(i) {
-
RichFaces.$('#{rich:clientId('progressBar')}').setValue(counter*5);
+ #{rich:component('progressBar')}.setValue(counter*5);
if ((counter++)>20){
clearInterval(intervalID);
- document.getElementById('button').disabled=false;
+ #{rich:element('startButton')}.disabled=false;
+ #{rich:element('pauseButton')}.disabled=true;
+ counter=1;
}
}
function startProgress(){
- counter=1;
- document.getElementById('button').disabled=true;
-
RichFaces.$('#{rich:clientId('progressBar')}').enable();
-
RichFaces.$('#{rich:clientId('progressBar')}').setValue(1);
+ #{rich:element('startButton')}.disabled=true;
+ #{rich:element('pauseButton')}.disabled=false;
+ #{rich:component('progressBar')}.enable();
+ #{rich:component('progressBar')}.setValue(counter*5);
intervalID = setInterval(updateProgress,1000);
}
- //]]>
+
+ function pauseProgress(){
+ #{rich:element('startButton')}.disabled=false;
+ #{rich:element('pauseButton')}.disabled=true;
+ #{rich:component('progressBar')}.disable();
+ clearInterval(intervalID);
+ }
+ //]]>
</script>
<rich:progressBar id="progressBar"
@@ -95,12 +105,14 @@
<f:facet name="initial">
<h:outputText id="initialOutput" value="Process
hasn't started yet"/>
</f:facet>
- <f:facet name="complete">
+ <f:facet name="finish">
<h:outputText id="completeOutput" value="Process
Done"/>
</f:facet>
</rich:progressBar>
- <button type="button" onclick="startProgress();"
style="margin: 9px 0px 5px;" id="button">Start
Progress</button>
+ <h:commandButton id="startButton" onclick="startProgress();
return false;" style="margin: 9px 0px 5px;" value="Start
Progress"/>
+ <h:commandButton id="pauseButton" onclick="pauseProgress();
return false;" style="margin: 9px 0px 5px;" disabled="true"
value="Pause Progress"/>
+
</ui:define>
<ui:define name="outOfTemplateAfter">