Menu

Busy Indicator

SourceForge Editorial Staff

Functional and Design Specification


Glossary

Summary and Background

The Busy Indicator component gives the user a visual indication that the application is in the middle of an operation, e.g. a long-running calculation or a network operation.

Goals


  • A simple component that the developer can place as needed.

Non-Goals


  • A skinnable busy indicator is not within the scope of this work
  • Determinate progress (e.g. "65% of 100% done) is not included in the scope of this work
  • Specialized components (e.g. a dialog box with a busy indicator and text) are not included in the scope of this work
  • This component will not have a modal mode, i.e. it will not provide functionality to block user interaction
  • This component will not implement a full-screen overlay mode; that additional functionality can be implemented relatively easily by the end developer

Usage Scenarios

When starting a long-running operation, such as a network operation, add the BusyIndicator to the display list. After the operation has completed, remove the BusyIndicator from the display list. An alternative to adding and removing the BusyIndictor to/from the display list is to leave the BusyIndicator on a controlBar and change the BusyIndicator's visibility to show and hide it. The BusyIndicator will be implemented not to use any processor time when it is not visible.

API Description

BusyIndicator

package spark.components
{
//--------------------------------------
//  Styles
//--------------------------------------

/**
 *  The interval to delay, in milliseconds, between rotations of this
 *  component. Controls the speed at which this component spins. 
 * 
 *  @default 50
 * 
 *  @langversion 3.0
 *  @playerversion Flash 10.1
 *  @playerversion AIR 2.5
 *  @productversion Flex 4.5
 *   
 */ 
<a href="Style%28name%3D%26quot%3BrotationInterval%26quot%3B%2C%20type%3D%26quot%3BNumber%26quot%3B%2C%20format%3D%26quot%3BTime%26quot%3B%2C%20inherit%3D%26quot%3Bno%26quot%3B%29">Style(name="rotationInterval", type="Number", format="Time", inherit="no")</a>

/**
 *  Color of any symbol of a component. 
 *  This is used by the BusyIndicator to color the spokes of the spinner.
 *   
 *  @default 0x000000
 * 
 *  @langversion 3.0
 *  @playerversion Flash 10.1
 *  @playerversion AIR 2.5
 *  @productversion Flex 4.5
 */ 
<a href="Style%28name%3D%26quot%3BsymbolColor%26quot%3B%2C%20type%3D%26quot%3Buint%26quot%3B%2C%20format%3D%26quot%3BColor%26quot%3B%2C%20inherit%3D%26quot%3Byes%26quot%3B%2C%20theme%3D%26quot%3Bspark%2Cmobile%26quot%3B%29">Style(name="symbolColor", type="uint", format="Color", inherit="yes", theme="spark,mobile")</a>

/**
 *  The BusyIndicator defines a component to display when a long-running 
 *  operation is in progress. This component is a spinner with twelve spokes.
 *  The color of the spokes is controled by the value of the symbolColor style.
 *  The transparency of this component can be modified using the alpha property
 *  but the alpha value of each spoke cannot be modified.
 * 
 *  <p>
 *  The speed at which this component spins is controled by the rotationInterval
 *  style. The rotationInterval style is the delay in milliseconds between
 *  rotates. Decrease the rotationInterval to increase the speed of the spin
 *  and increase the rotationInterval to slow the spin.
 *  </p>
 * 
 *  <p>The BusyIndicator has the following default characteristics:</p>
 *  <table class="innertable">
 *     <tr><th>Characteristic</th><th>Description</th></tr>
 *     <tr><td>Default size</td><td>160 DPI: 26x26 pixels<br>
 *                                  240 DPI: 40x40 pixels<br>
 *                                  320 DPI: 52x52 pixels</td></tr>
 *     <tr><td>Minimum size</td><td>20x20 pixels</td></tr>
 *     <tr><td>Maximum size</td><td>No limit</td></tr>
 *  </table>
 *  
 *  The diameter of the BusyIndicator's spinner is the minimum of the width and
 *  height of the component. The diameter must be an even number so will be
 *  reduced by one if it is odd.
 * 
 *  @mxml
 *  
 *  <p>The <code>&lt;s:BusyCursor&gt;</code> tag inherits the symbolColor style
 *  and adds the rotationInterval style.</p>
 *  
 *  <pre>
 *  &lt;s:BusyIndicator
 *     
 *    <strong>Styles</strong>
 *    rotationInterval=50
 * 
 *    <strong>Spark Styles</strong>
 *    symbolColor="0x000000"
 *  
 *  &gt;
 *  </pre>
 *
 *  
 *  @langversion 3.0
 *  @playerversion Flash 10.1
 *  @playerversion AIR 2.5
 *  @productversion Flex 4.5
 */
public class BusyIndicator extends UIComponent
{

    //--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------

    /**
     *  Constructor.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10.1
     *  @playerversion AIR 2.5
     *  @productversion Flex 4.5
     */
    public function BusyIndicator();

Examples and Usage

The BusyIndicator can be placed in a control bar and set to visible when needed. When not visible or not on the display list the BusyIndicator will not consume any processor cycles.

  <s:Panel id="panel" title="Busy Indicator Example" 
             width="75%" height="75%"
             horizontalCenter="0" verticalCenter="0">
        <s:controlBarLayout>
            <s:HorizontalLayout/>
        </s:controlBarLayout>
        <s:controlBarContent>
            <s:Button label="B1" />
            <s:Button label="B2" />
            <s:BusyIndicator id="bi" visible="false" />
        </s:controlBarContent>

        <s:VGroup left="10" right="10" top="10" bottom="10">
            <s:Label width="100%" color="blue"
                     text="Click the Button control to see panel properties."/>
            <s:TextArea id="panelPropertyArea" width="100%" height="100%"/>
            <s:Button label="Busy" click="{bi.visible = !bi.visible}" />
        </s:VGroup>
    </s:Panel>

Compiler Work

N/A.

Performance

If the BusyIndicator is not on the display list or is not visible it will not rotate and consume processor cycles.


Related

Wiki: Flex 4.5

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.