OverviewSince 3.0 Progress bar is a progress indicator that can work on the client side by itself or gets its progress update from the server using ajax.
Getting StartedClient side only: <script type="text/javascript"> function begin() { this.progressInterval = setInterval ( function() { clientSideBar.setValue(clientSideBar.getValue() + 10); } , 2000); } function stop() { clearInterval(this.progressInterval); clientSideBar.setValue(0); } </script> ... <ace:panel> <ace:progressBar widgetVar="clientSideBar" /> </ace:panel> ... <h:commandButton onclick="begin();" ... /> <h:commandButton onclick="stop();" ... /> <ace:progressBar widgetVar="#{upload.widgetVarName}" usePolling="true" pollingInterval="2000" value="#{upload.progressValue}" ... /> ... <h:commandButton onclick="#{upload.widgetVarName}.start();" ... /> Attributes
usePolling specifies the mode of progressBar, in polling mode progress value is retrieved periodically from a backing bean. cancelListener, changeListener, completeListener are the listeners for the different stages of the progress. In the change event you can get the value and percentage of the progress bar. pollingInterval is time between polls to the server in milliseconds. Event Listeners
Client Behavior Events
JavaScript APIICEfaces 3.xThe client side progress bar object is exposed through the global variable name specified in the widgetVar attribute. You can use the getValue() and setValue() methods to read and change the value. Use the start() and cancel() methods for starting/cancelling the progress: <ace:progressBar widgetVar="sampleProgeessBar" value="#{bean.value}" /> <h:commandButton value="Start" onclick="sampleProgeessBar.start();" ... /> <h:commandButton value="Cancel" onclick="sampleProgeessBar.cancel();" ... /> ICEfaces 4+The "widgetVar" attribute on the ACE components has been removed in ICEfaces 4 and in its place a new "ice.ace.instance()" client JavaScript object lookup API has been introduced. The reason for this change is to enable lazy-initialization of the ACE component JavaScript objects to improve runtime performance and reduce browser memory use. You can use the getValue(), setValue(), start() and cancel() methods as described above. widget = ice.ace.instance('frm:myProgressBar'); To illustrate this change, see the before and after code example below. Before (ICEfaces 3 API)<ace:progressBar widgetVar="sampleProgeessBar" value="#{bean.value}" /> <h:commandButton value="Start" onclick="sampleProgeessBar.start();" ... /> <h:commandButton value="Cancel" onclick="sampleProgeessBar.cancel();" ... /> After (ICEfaces 4 API)<ace:progressBar id="myProgressBar" value="#{bean.value}" /> <h:commandButton value="Start" onclick="ice.ace.instance('frm:myProgressBar').start();" ... /> <h:commandButton value="Cancel" onclick="ice.ace.instance('frm:myProgressBar').cancel();" ... />
Keyboard and ARIA SupportThe following ARIA roles are supported: progressbar. CSS ClassesThe following markup represents the basic HTML structure of the component and the CSS classes it uses. <div class="[user defined classes] ui-progressbar ui-widget ui-widget-content ui-corner-all" style="[user defined styles]"> <div class="ui-progressbar-value ui-widget-header ui-corner-left"></div> </div> Known IssuesNone. Additional Resources |
ProgressBar
You are viewing the current version of this page. (v. 27)
© Copyright 2021 ICEsoft Technologies Canada Corp.