How to Use the Progress Bar Component
The Progress Bar JSF component that was created by Matthew Bohm
allows
users to display the progress of a lengthy task in-screen. The
progress percentage is updated through an AJAX call to a manage
bean. The component also facilitates a call back to a Javascript
function once the task is complete. The
tag library for
the Rating component can be accessed using the
declaration:
<%@taglib prefix="ui" uri="http://java.sun.com/blueprints/ui/14"%>
An example of the JSF progressBar component's use is as follows:
<ui:progressBar id="progressBar" interval="1000"
onComplete="progressComplete" startOperation="#{ProgressBarBean.startTask}"
percentage="#{ProgressBarBean.percentage}" style="width: 400px"/>
JSP
Tag Attributes
The Rating component supports
the following attributes.
- percentage - Value Expression that returns a number between 0 and
100.
- interval - A literal or value expression that returns the number
of milliseconds between calls to the method referred to by the value
attribute.
- percentageText - Custom text to indicate the progress made so far.
- startOperation - A method binding, invoked via AJAX, that starts
the long-running process.
- stopOperation - A method binding, invoked via AJAX, that stops
the long-running process.
- onComplete - A literal or value expression that represents a
scripting function that will be executed when progress is complete.
- onUpdate - A literal or value expression that represents a
scripting function that will be executed each time progress is updated.
- autoStart - Boolean indicating whether this progress bar begins
polling when the page loads.
- action - Action or literal to invoke if the page is submitted via
a client-side call to the scripting function
bpui.progressbar.submitForm.
- actionListener - Method binding representing a method that
receives action from this, and possibly other, components.
- immediate - Flag indicating that, if this component is activated
by the user, notifications should be delivered to interested listeners
and actions immediately (that is, during Apply Request Values phase)
rather than waiting until Invoke Application phase.
- style - CSS style(s) for the component.
- styleClass - CSS styleClass for the component.
- binding - Binding to the component in a page bean.
CSS Overrides
If you would like to override the look of the progress bar, the class
names that are used by the progress bar can be configured. For
example:
<style>
.bpui_progressbar_barAreaContainer {
border-style: groove !important;
border-width: medium !important;
}
.bpui_progressbar_portionComplete {
background: #FF0000 !important;
}
.bpui_progressbar_portionRemaining {
background: lightgrey !important;
}
</style>
© Sun Microsystems 2006. All of the material in The
Java BluePrints Solutions Catalog is copyright-protected
and may not be published in other works without express
written permission from Sun Microsystems.