silverorange Code


Swat.SwatProgressBar
/Swat/SwatProgressBar.php at line 31

Class SwatProgressBar

SwatObject
└─SwatUIObject
└─SwatWidget
└─SwatControl
└─SwatProgressBar

public class SwatProgressBar
extends SwatControl

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.

Copyright:
2007 silverorange
License:
http://www.gnu.org/copyleft/lesser.html LGPL License 2.1

Field Summary
final mixed

ORIENTATION_BOTTOM_TO_TOP

Progress bar displays vertically and completes from bottom to top.

final mixed

ORIENTATION_LEFT_TO_RIGHT

Progress bar displays horizontally and completes from left to right.

final mixed

ORIENTATION_RIGHT_TO_LEFT

Progress bar displays horizontally and completes from right to left.

final mixed

ORIENTATION_TOP_TO_BOTTOM

Progress bar displays vertically and completes from top to bottom.

string

$content_type

Optional content type for text of this progress bar.

string

$length

Length of this progress bar in cascading style-sheet units.

integer

$orientation

Orientation of this progress bar.

string

$text

Text to show beneath the progress bar.

string|array

$text_value

Value or array of values to substitute into the SwatProgressBar::$text property.

float

$value

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

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.

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

Field Detail

/Swat/SwatProgressBar.php at line 48

ORIENTATION_BOTTOM_TO_TOP

public final mixed ORIENTATION_BOTTOM_TO_TOP = 3

Progress bar displays vertically and completes from bottom to top


/Swat/SwatProgressBar.php at line 38

ORIENTATION_LEFT_TO_RIGHT

public final mixed ORIENTATION_LEFT_TO_RIGHT = 1

Progress bar displays horizontally and completes from left to right


/Swat/SwatProgressBar.php at line 43

ORIENTATION_RIGHT_TO_LEFT

public final mixed ORIENTATION_RIGHT_TO_LEFT = 2

Progress bar displays horizontally and completes from right to left


/Swat/SwatProgressBar.php at line 53

ORIENTATION_TOP_TO_BOTTOM

public final mixed ORIENTATION_TOP_TO_BOTTOM = 4

Progress bar displays vertically and completes from top to bottom


/Swat/SwatProgressBar.php at line 116

content_type

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.


/Swat/SwatProgressBar.php at line 127

length

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.


/Swat/SwatProgressBar.php at line 67

orientation

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.


/Swat/SwatProgressBar.php at line 92

text

public string $text

Text to show beneath the progress bar

Optionally uses vsprintf() syntax, for example:

<?php
$progress_bar
->text '%s%% complete';
?>

See Also:
SwatProgressBar::$text_value

/Swat/SwatProgressBar.php at line 107

text_value

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.

See Also:
SwatProgressBar::$text

/Swat/SwatProgressBar.php at line 78

value

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%.


Constructor Detail

/Swat/SwatProgressBar.php at line 139

SwatProgressBar

public SwatProgressBar(string id)

Creates a new progress bar

Parameters:
id - a non-visible unique id for this widget.
See Also:
SwatWidget::__construct()

Method Detail

/Swat/SwatProgressBar.php at line 164

display

public void display()

Displays this progress bar

Throws:
if this progress bar's $length property is not a valid cascading style-sheet dimension.

/Swat/SwatProgressBar.php at line 194

displayBar

protected void displayBar()

Displays the bar part of this progress bar

Throws:
if this progress bar's $length property is not a valid cascading style-sheet dimension.

/Swat/SwatProgressBar.php at line 269

displayText

protected void displayText()

Displays the text part of this progress bar


/Swat/SwatProgressBar.php at line 314

getCSSClassNames

protected array getCSSClassNames()

Gets the array of CSS classes that are applied to this progress bar

Returns:
the array of CSS classes that are applied to this progress bar.
See Also:
SwatUIObject::getCSSClassString()

/Swat/SwatProgressBar.php at line 299

getInlineJavaScript

protected string getInlineJavaScript()

Gets inline JavaScript for this progress bar

Returns:
inline JavaScript for this progress bar.

silverorange Code