qnx.fuse.ui.progress.ProgressBar

ProgressBar

Properties | Methods | Events | Examples


Packageqnx.fuse.ui.progress
Classpublic class ProgressBar
InheritanceProgressBar Inheritance SkinnableComponent Inheritance UIComponent Inheritance flash.display.MovieClip
Implements IProgress
Subclasses PercentageBar

The ProgressBar class shows the progress of a task or operation:

A progress bar.

The ProgressBar class provides the temporal feedback functionality for the API. You can use the progress bar to show progress information for processor-intensive operations or to show progress information whenever data is being loaded. This feedback ensures the user that the operating system remains responsive during complex operations.

In addition to its default state, ProgressBarStates.PLAY, the ProgressBar has three states that can provide additional context about the operation being performed: ProgressBarStates.PAUSED, ProgressBarStates.ERROR and ProgressBarStates.BUFFERING. These states can be set using the ProressBar.state setter.

The paused state of the ProgressBar: A paused progress bar.
The error state of the ProgressBar: A progress bar that has encountered an error.
The buffering state of the ProgressBar: A buffering progress bar.


Class information:
BlackBerry 10 Version:   10.0.0
Found in:  qnxui.swc

View the examples

See also

PercentageBar
ActivityIndicator
set.state



Public Properties

 PropertyDefined By
 InheritedcontextActions : Vector.<ActionSet>
Gets or Sets a Vector of ActionSet objects.
UIComponent
 InheritedcontextMultiSelectText : String
Gets or Sets a String to be displayed when showing the Multi Select Context Menu.
UIComponent
 InheritedcurrentTheme : String
[read-only] Returns the current theme this component is styled with.
UIComponent
 InheritedexplicitHeight : Number
[read-only] Returns the explicit height (actual height, in pixels) of the UI component.
UIComponent
 InheritedexplicitWidth : Number
[read-only] Returns the explicit width (actual width, in pixels) of the UI component.
UIComponent
 Inheritedid : String
The id is a name for the component that can be used in CSS using the # selector.
UIComponent
 InheritedincludeInLayout : Boolean
Specifies whether or not the component should be included in its parent container's layout.
UIComponent
 InheritedlayoutData : Object
Gets or sets the layoutData.
UIComponent
 Inheritedlocale : String
Gets or sets the current locale of the component.
UIComponent
 InheritedminHeight : Number
Gets or sets the minimum preferred height of the control.
UIComponent
 InheritedminWidth : Number
Gets or sets the minimum preferred width of the control.
UIComponent
  progress : Number
Gets or sets the current progress value as indicated by the progress bar.
ProgressBar
  state : String
[override] The ProgressBar has four valid states, contained in the ProgressBarStates class: ProgressBarStates.PLAY: The task is progressing normally. ProgressBarStates.PAUSE: The task is paused, typically because of user interaction. ProgressBarStates.ERROR: The task has encountered an error. ProgressBarStates.BUFFERING: The task is temporarily paused due to external factors (like latency), but this paused is expected and progress will continue.
ProgressBar
 InheritedstyleChildren : Boolean
Allows you to style the children of this component with CSS.
UIComponent

Protected Properties

 PropertyDefined By
 InheritedaccessibilityImplimentationClass : Class
UIComponent
  cssID : String
[override] [read-only] Returns the CSS ID of the component.
ProgressBar
 InheritedexplicitLocale : Boolean
Set to true when the locale property has been set externally.
UIComponent
 InheritedinternalID : String
The Component's Id used for styling.
UIComponent
 InheritedlongPressEnabled : Boolean
Specifies whether the UIComponent can detect a long press.
UIComponent

Public Methods

 MethodDefined By
  
Creates a new ProgressBar instance.
ProgressBar
 Inherited
Cancels a long press from occuring on the component.
UIComponent
 Inherited
childChanged(resizedChild:DisplayObject = null):Boolean
Notifies the UIComponent that one or more of its children has changed in a manner that may affect this object's layout.
UIComponent
 Inherited
configureStyles(styles:Array):void
[override] The SkinnableComponent version styles the component with the base style first, and then styles it with the current state's style.
SkinnableComponent
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
Returns the CSS selector for the object, composing it from its position in the display hierarchy and an optional ID selector.
UIComponent
 Inherited
Returns the size options for the given control.
UIComponent
 Inherited
Calling this method results in a call to the components validateDisplayList() method before the display list is rendered.
UIComponent
 Inherited
Calling this method results in a call to the components validateProperties() method before the display list is rendered.
UIComponent
 Inherited
measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
This method calls doMeasure() in order to calculate the preferred size of the control.
UIComponent
 Inherited
setActualSize(w:Number, h:Number):void
Sets the width and height of the object without setting the explicitWidth and explicitHeight.
UIComponent
 Inherited
setLayoutBounds(bounds:Rectangle):void
Sets the receiver's size and location to the rectangular area specified by the arguments.
UIComponent
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
 Inherited
setSkin(newSkin:Object):void
Set the skin object on the component for it to render.
SkinnableComponent
  
setTrackSkin(newSkin:Object):void
Creates the track skin for the ProgressBar.
ProgressBar
 Inherited
updateDefaultLocale(updateChildren:Boolean = true):void
Updates the locale property to be the same as the locale of the device.
UIComponent
 Inherited
Lets a component that contains text know that it should update its font formats as the font settings have changed.
UIComponent
 Inherited
Validates the display list of the component by calling the updateDisplayList().
UIComponent
 Inherited
Validates the component immediately by calling validateProperties(), validateSizes(), and validateDisplayList() if necessary.
UIComponent
 Inherited
Validates the properties of the component by calling the commitProperties() method.
UIComponent

Protected Methods

 MethodDefined By
 Inherited
allowShowContextMenu(target:IEventDispatcher):Boolean
When the user presses on the component this method is called with the object that dispatched the event.
UIComponent
 Inherited
Process properties of the component.
UIComponent
 Inherited
Process the state of the component.
UIComponent
 Inherited
Style the component after the style has changed.
UIComponent
 Inherited
doMeasure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
Performs a measurement on the control, and returns a LayoutMeasurement instance containing the available width and height within the layout.
UIComponent
 Inherited
excemptFromCSSStyling(target:*, property:String = null):void
Exempts a property on an object from being styled by CSS.
UIComponent
 Inherited
flushCache():void
Invoked as part of parentLayoutChanged.
UIComponent
 Inherited
getStyleApplier():Function
A style applier is a method that gets called every time a property from the stylesheet should be applied to the component.
UIComponent
 Inherited
getStyleForState(state:String):IStyleable
A utility method to get the styling information for a given state.
SkinnableComponent
 Inherited
onAdded():void
Called when the instance is added to the stage.
UIComponent
 Inherited
Is called when a user is no longer long pressing on the component.
UIComponent
 Inherited
Is called when a user long presses on the component.
UIComponent
 Inherited
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
 Inherited
Invalidates the parent's size and display list if includeInLayout property is set to true.
UIComponent
 Inherited
Calling this function will refresh the ContextMenu with whatever actions were set by contextActions.
UIComponent
 Inherited
Shows the context menu if there are contextActions associated with the control.
UIComponent
 Inherited
styleState():void
Style the component after state has changed.
UIComponent
 Inherited
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Sets the size and position of the children of the component.
UIComponent
 Inherited
updateSkin(unscaledWidth:Number, unscaledHeight:Number):void
Updates the skin's dimensions.
SkinnableComponent

Events

 Event Summary Defined By
 InheritedDispatched when an action in the Context Menu is selected.UIComponent
 InheritedDispatched when the Context Menu has closed to the DISMISSED state.UIComponent
 InheritedDispatched when the ContextMenu is closing to the DISMISSED state.UIComponent
 InheritedDispatched when the Context Menu has opened to the PEEK or EXPANDED state.UIComponent
 InheritedDispatched when the ContextMenu is opening from the DISMISSED state.UIComponent
 InheritedDispatched when the CrossCut multiselect has been canceled.UIComponent

Property Detail

cssID


cssID:String  [read-only]
[override]

Returns the CSS ID of the component. The CSS ID is used for identifying the type of component in CSS.

The default value is ProgressBar.


Implementation

protected function get cssID():String

progress


progress:Number

Gets or sets the current progress value as indicated by the progress bar. This property takes a value between 0 and 1.

For example, the following listing uses a counter to update the progress property. The counter value is divided by 100 in order to specify a percentage:

private function handleTimerTick( e:TimerEvent ):void
{
    counter++;
    myProgress.progress = counter/100;
}
         


Implementation

public function get progress():Number
public function set progress(value:Number):void

state


state:String
[override]

The ProgressBar has four valid states, contained in the ProgressBarStates class:

  • ProgressBarStates.PLAY: The task is progressing normally.
  • ProgressBarStates.PAUSE: The task is paused, typically because of user interaction.
  • ProgressBarStates.ERROR: The task has encountered an error.
  • ProgressBarStates.BUFFERING: The task is temporarily paused due to external factors (like latency), but this paused is expected and progress will continue.


Implementation

public function get state():String
public function set state(value:String):void

See also

ProgressBarStates

Constructor Detail

ProgressBar()


public function ProgressBar()

Creates a new ProgressBar instance.

Method Detail

setTrackSkin()


public function setTrackSkin(newSkin:Object):void

Creates the track skin for the ProgressBar. This can be thought of as the backgrond on which the fill skin sits on top of. Set the fill skin using setSkin

If a skin is found, it is removed and replaced.

The newSkin parameter can be one of three different types: Class, String, or DisplayObject instance.

  • If you pass in a Class, a new instance of that class is created.
  • If you pass in a String, flash.utils.getDefinitionByName will be used to try and determine a class to use.
  • If you pass in a DisplayObject instance it is used as the skin the x and y values of the instance are set to 0.

Skins must implement the ISkin interface.

Parameters

newSkin:Object — Either a Class, DisplayObject or String linkage to use as the skin. The created object must implement ISkin

See also

ISkin
setSkin

Examples

The following listing creates a ProgressBar instance. It contains a simple timer routine that is used to update the progress value.
package
{
    import flash.display.Sprite;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    
    import qnx.fuse.ui.progress.ProgressBar;
    
    [SWF(height="1280", width="768", frameRate="60", backgroundColor="#FFFFFF")]
    public class myProgressSample extends Sprite
    {
        private var myProgress:ProgressBar;
        private var timer:Timer;
        private var counter:int;
        
        public function myProgressSample()
        {
            initializeUI();
        }
        
        private function initializeUI():void 
        {
            myProgress = new ProgressBar();
            myProgress.setPosition(400, 300);                
            myProgress.width = 200;
            myProgress.progress = 0;            
            
            this.addChild(myProgress);
            
            // counter to keep track of how many times the timer has ticked
            counter = 0;
            timer = new Timer(100,100);
            timer.addEventListener(TimerEvent.TIMER,handleTimerTick);
            timer.addEventListener(TimerEvent.TIMER_COMPLETE,handleTimerComplete);
            timer.start();
        }
        
        private function handleTimerComplete(e:TimerEvent):void
        {
            timer.removeEventListener(TimerEvent.TIMER,handleTimerTick);
            timer.removeEventListener(TimerEvent.TIMER_COMPLETE,handleTimerComplete);
            counter = 0;
        }
        
        private function handleTimerTick( e:TimerEvent ):void
        {
            counter++;
            myProgress.progress = counter/100;
        }
    }
}
     




comments powered by Disqus