The <rich:progressBar> component is designed for displaying a progress bar which shows the current status of the process.
Table 6.329. rich : progressBar attributes
Attribute Name | Description |
---|---|
actionListener | MethodBinding pointing at method accepting an ActionEvent with return type void |
ajaxSingle | if "true", submits ONLY one field/link, instead of all form controls |
binding | The attribute takes a value-binding expression for a component property of a backing bean |
bypassUpdates | If "true", after process validations phase it skips updates of model beans on a force render response. It can be used for validating components input |
completeClass | CSS class that defines style for progress line rendering |
data | Serialized (on default with JSON) data passed on the client by a developer on AJAX request. It's accessible via "data.foo" syntax |
dir | Direction indication for text that does not inherit directionality. Valid values are "LTR" (left-to-right) and "RTL" (right-to-left) |
enabled | Enables/disables polling |
eventsQueue | Name of requests queue to avoid send next request before complete other from same event. Can be used to reduce number of requests of frequently events (key press, mouse move etc.) |
finishClass | CSS class that defines style for complete state of the component |
focus | id of element to set focus after request completed on client side |
id | Every component may have a unique id that is automatically created if omitted |
ignoreDupResponses | Attribute allows to ignore an Ajax Response produced by a request if the newest 'similar' request is in a queue already. ignoreDupResponses="true" does not cancel the request while it is processed on the server, but just allows to avoid unnecessary updates on the client side if the response isn't actual now |
immediate | True means, that the default ActionListener should be executed immediately (i.e. during Apply Request Values phase of the request processing lifecycle), rather than waiting until the Invoke Application phase |
initialClass | CSS class that defines style for initial state of the component |
interval | Interval (in ms) for call poll requests. Default value 1000 (1 sec) |
label | Attribute defines a simple label instead of rendering children component |
limitToList | If "true", updates on client side ONLY elements from this 'reRender' property. If "false" (default) updates all rendered by ajax region components |
maxValue | Max value, after which complete state should be rendered |
minValue | Min value when initial state should be rendered |
mode | Attributes defines AJAX or CLIENT modes for component |
onbeforedomupdate | JavaScript code for call before DOM has been updated on client side |
onclick | HTML: a script expression; a pointer button is clicked |
oncomplete | JavaScript code for call after request completed on client side |
ondblclick | HTML: a script expression; a pointer button is double-clicked |
onkeydown | HTML: a script expression; a key is pressed down |
onkeypress | HTML: a script expression; a key is pressed and released |
onkeyup | HTML: a script expression; a key is released |
onmousedown | HTML: script expression; a pointer button is pressed down |
onmousemove | HTML: a script expression; a pointer is moved within |
onmouseout | HTML: a script expression; a pointer is moved away |
onmouseover | HTML: a script expression; a pointer is moved onto |
onmouseup | HTML: script expression; a pointer button is released |
onsubmit | JavaScript code for call before submission of ajax event |
parameters | Parameters for macrosubstitution in the label |
progressVar | Provides access to value of the component on the client |
remainClass | CSS class that defines style for remained part of progress bar |
rendered | If "false", this component is not rendered |
reRender | Id['s] (in format of call UIComponent.findComponent()) of components, rendered in case of AjaxRequest caused by this component. Can be single id, comma-separated list of Id's, or EL Expression with array or Collection |
reRenderAfterComplete | Set of componets to rerender after completion |
status | ID (in format of call UIComponent.findComponent()) of Request status component |
style | CSS style(s) is/are to be applied when this component is rendered |
styleClass | CSS class that defines style for progress bar |
timeout | Response waiting time on a particular request. If a response is not received during this time, the request is aborted |
title | Advisory title information about markup elements generated for this component |
value | Sets the current value of the progress |
Table 6.330. Component identification parameters
Name | Value |
---|---|
component-type | org.richfaces.ProgressBar |
component-family | org.richfaces.ProgressBar |
renderer-type | org.richfaces.renderkit.ProgressBarRenderer |
tag-class | org.richfaces.taglib.ProgressBarTag |
Here is a simple example of how the component can be used on a page:
Example:
...
<progressBar:progressBar value="#{bean.incValue1}"/>
...
Example:
import org.richfaces.component.html.progressBar;
...
HtmlColumns myColumns = new progressBar();
...
As it was mentioned above, the <rich:progressBar> component displays the status of the ongoing process. The component has a number of key attributes.
The "value" attribute sets the current value of the process. Status of the process is calculated basing on "value" attribute.
Example:
...
<rich:progressBar
value="#{bean.incValue}" >
</rich:progressBar>
...
The <rich:progressBar> starts and finishes rendering its state being governed by "minValue" (default value – "0") and "maxValue" (default value is "100") attributes relatively. See the following example.
Example:
...
<rich:progressBar value="#{bean.incValue}" minValue="50" maxValue="400"/>
...
The "interval" attribute defines the frequency of status polling. Polling is active while the component is operational.
Example:
...
<rich:progressBar value="#{bean.incValue}" id="progrs" interval="900"/>
...
The "parameters" attribute allows to send some dynamical data to the component which is displayed in the informational part. Parameters can be passed through "parameters" attribute, or from component control.
Example:
...
<rich:progressBar progressVar="progress" parameters="param1:'1'" >
<h:outputText="{param1} task #{progress} %"/>
</rich:progressBar>
...
The "label" attribute is responsible for displaying informational data on the progress bar, if it's not displayed using children components. If this attribute is not set and the children components are not used either, no textual information regarding ongoing process will be indicated. In order to indicate the current status you need to pass the value to this attribute. Please see an example.
Example:
...
<rich:progressBar value="#{bean.incValue}" id="progrs" label="{value}%" >
</rich:progressBar>
...
In order to display textual and numerical information on the progress bar (as it was said above this can be aslo performed using "label" attribute ) you can also use this code:
Example:
...
<h:outputText value="{value}%" ></h:outputText>
...
The component can also employ "initial" and "complete" facets to display the states of the process: "initial" facet is displayed when the progress value is less or equal to "minValue" , and the "complete" facet is shown when the value is greater or equal to "maxValue" . Please see an example below.
Example:
...
<progressBar:progressBar value="#{bean.incValue1}" >
<f:facet name="initial">
<h:outputText value="Process not started"></h:outputText>
</f:facet>
<f:facet name="complete">
<h:outputText value="Process completed"></h:outputText>
</f:facet>
</progressBar:progressBar>
...
However, the usage of these facets is optional. If you omit them nothing will be displayed.
The <rich:progressBar> component can be used in two modes: Ajax (default) and Client. In order to define the mode you need to use "mode" attribute.
Ajax - polling is activated when the component is enabled to check its value.
Client - component updates after its value changed through JavaScript API.
You can also use macrosubstitution in both Client and Ajax modes, which allows you to pass "minValue" , "maxValue" and "Value" to the facet that is responsible for displaying information on the progress bar, using {minValue} , {maxValue} and {Value} syntax. See the example.
Example:
...
<progressBar:progressBar value="#{bean.incValue1}"
minValue="400"
maxValue="900">
<h:outputText value="Min value is {minValue}, current value is {value}, max value is {maxValue}"></h:outputText>
</progressBar:progressBar>
...
Table 6.331. JavaScript API
Function | Description |
---|---|
enable() | Begins polling for ajax mode |
disable() | Stops polling for ajax mode |
setValue(value) | Updates the progress of the process |
setLabel(label) | Update the label for the process |
For skinnability implementation, the components use a style class redefinition method. Default style classes are mapped on skin parameters.
There are two ways to redefine the appearance of all <rich:progressBar> components at once: