SwatObject
└─SwatUIObject
└─SwatWidget
└─SwatControl
└─SwatProgressBar
public class SwatProgressBar
extends SwatControl
| Field Summary | |
|---|---|
| final mixed | Progress bar displays vertically and completes from bottom to top. |
| final mixed | Progress bar displays horizontally and completes from left to right. |
| final mixed | Progress bar displays horizontally and completes from right to left. |
| final mixed | Progress bar displays vertically and completes from top to bottom. |
| string | Optional content type for text of this progress bar. |
| string | Length of this progress bar in cascading style-sheet units. |
| integer | Orientation of this progress bar. |
| string | Text to show beneath the progress bar. |
| string|array | Value or array of values to substitute into the SwatProgressBar::$text property. |
| float | The current value of this progress bar. |
| Constructor Summary | |
|---|---|
SwatProgressBar(string id) Creates a new progress bar. |
|
| Method Summary | |
|---|---|
| void | display() Displays this progress bar. |
| protected void | Displays the bar part of this progress bar. |
| protected void | Displays the text part of this progress bar. |
| protected array | Gets the array of CSS classes that are applied to this progress bar. |
| protected string | Gets inline JavaScript for this progress bar. |
| Methods inherited from Swat.SwatControl | |
|---|---|
| addMessage, getNote, printWidgetTree | |
| Methods inherited from Swat.SwatWidget | |
|---|---|
| addCompositeWidget, addMessage, confirmCompositeWidgets, copy, createCompositeWidgets, display, displayHtmlHeadEntries, getCSSClassNames, getCompositeWidget, getCompositeWidgets, getFocusableHtmlId, getHtmlHeadEntrySet, getMessages, hasMessage, init, isDisplayed, isInitialized, isProcessed, isSensitive, printWidgetTree, process, replaceWithContainer | |
| Methods inherited from Swat.SwatUIObject | |
|---|---|
| addComment, addJavaScript, addStyleSheet, addTangoAttribution, copy, getCSSClassNames, getCSSClassString, getFirstAncestor, getHtmlHeadEntrySet, getInlineJavaScript, getUniqueId, isVisible | |
public final mixed ORIENTATION_BOTTOM_TO_TOP = 3
Progress bar displays vertically and completes from bottom to top
public final mixed ORIENTATION_LEFT_TO_RIGHT = 1
Progress bar displays horizontally and completes from left to right
public final mixed ORIENTATION_RIGHT_TO_LEFT = 2
Progress bar displays horizontally and completes from right to left
public final mixed ORIENTATION_TOP_TO_BOTTOM = 4
Progress bar displays vertically and completes from top to bottom
public string $content_type = 'text/plain'
Optional content type for text of this progress bar
Defaults to 'text/plain', use 'text/xml' for XHTML fragments.
public string $length = '200px'
Length of this progress bar in cascading style-sheet units
This determines the width of horizontal progress bars and the height of vertical progress bars. Any valid cascading style-sheet dimension value may be used.
public integer $orientation = self::ORIENTATION_LEFT_TO_RIGHT
Orientation of this progress bar
This should be one of the SwatProgressBar::ORIENTATION_* constants. If
an invalid value is used,
SwatProgressBar::ORIENTATION_LEFT_TO_RIGHT is used.
public string $text
Text to show beneath the progress bar
Optionally uses vsprintf() syntax, for example:
<?php
$progress_bar->text = '%s%% complete';
?>
public string|array $text_value = null
Value or array of values to substitute into the
SwatProgressBar::$text property
The value property may be specified either as an array of values or as
a single value. If an array is passed, a call to vsprintf() is done
on the SwatProgressBar::$text property. If the value is a string
a single sprintf() call is made.
public float $value
The current value of this progress bar
This should be a value between 0 and 1. If the number is greater than 1 the progress bar will display as 100%. If the number is less than 0, the progress bar will display as 0%.
public SwatProgressBar(string id)
Creates a new progress bar
id - a non-visible unique id for this widget.public void display()
Displays this progress bar
protected void displayBar()
Displays the bar part of this progress bar
protected void displayText()
Displays the text part of this progress bar
protected array getCSSClassNames()
Gets the array of CSS classes that are applied to this progress bar
protected string getInlineJavaScript()
Gets inline JavaScript for this progress bar
Progress bar
Progress bars should only be used to indicate progress. Use a separate widget to display values.
This progress bar is easily scripted using JavaScript. The JavaScript method SwatProgressBar::setValue() sets the value of the progress bar. The JavaScript methods SwatProgressBar::pulse() changes the progress bar into pulse mode. Use pulse mode if progress is happening but there is no way to measure the progress.
Both the SwatProgressBar PHP class and SwatProgressBar JavaScript class are accurate to four decimal places. This translates to one-hundredth of a percent.