You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ti...@apache.org on 2012/06/03 19:43:54 UTC
svn commit: r1345721 - in /incubator/flex/whiteboard/tink/progress/src: ./
ws/ ws/tink/ ws/tink/spark/ ws/tink/spark/controls/
ws/tink/spark/controls/supportClasses/ ws/tink/spark/layouts/
ws/tink/spark/layouts/supportClasses/ ws/tink/spark/primitives/...
Author: tink
Date: Sun Jun 3 17:43:53 2012
New Revision: 1345721
URL: http://svn.apache.org/viewvc?rev=1345721&view=rev
Log:
Spark ProgressIndicator initial import.
Added:
incubator/flex/whiteboard/tink/progress/src/
incubator/flex/whiteboard/tink/progress/src/defaults.css (with props)
incubator/flex/whiteboard/tink/progress/src/design.xml (with props)
incubator/flex/whiteboard/tink/progress/src/manifest.xml (with props)
incubator/flex/whiteboard/tink/progress/src/ws/
incubator/flex/whiteboard/tink/progress/src/ws/tink/
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressIndicator.as
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressResize.as
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressWedge.as
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/supportClasses/
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/supportClasses/IProgress.as
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/EllipseLayout.as
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/ProgressLayout.as
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/HorizontalDirection.as
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/RadialDirection.as
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/VerticalDirection.as
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/primitives/
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/primitives/Wedge.as
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressIndicatorResizeSkin.mxml
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressIndicatorWedgeSkin.mxml
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressResizeSkin.mxml
incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressWedgeSkin.mxml
Added: incubator/flex/whiteboard/tink/progress/src/defaults.css
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/defaults.css?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/defaults.css (added)
+++ incubator/flex/whiteboard/tink/progress/src/defaults.css Sun Jun 3 17:43:53 2012
@@ -0,0 +1,18 @@
+/* CSS file */
+@namespace "library://ns.tink.ws/flex/spark";
+
+ProgressIndicator
+{
+ skinClass : ClassReference("ws.tink.spark.skins.controls.ProgressIndicatorResizeSkin");
+}
+
+ProgressResize
+{
+ skinClass : ClassReference("ws.tink.spark.skins.controls.ProgressResizeSkin");
+}
+
+ProgressWedge
+{
+ skinClass : ClassReference("ws.tink.spark.skins.controls.ProgressWedgeSkin");
+}
+
Propchange: incubator/flex/whiteboard/tink/progress/src/defaults.css
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/flex/whiteboard/tink/progress/src/design.xml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/design.xml?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/design.xml (added)
+++ incubator/flex/whiteboard/tink/progress/src/design.xml Sun Jun 3 17:43:53 2012
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<design>
+ <namespaces>
+ <namespace prefix="st" uri="library://ns.tink.ws/flex/spark"/>
+ </namespaces>
+</design>
\ No newline at end of file
Propchange: incubator/flex/whiteboard/tink/progress/src/design.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/flex/whiteboard/tink/progress/src/manifest.xml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/manifest.xml?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/manifest.xml (added)
+++ incubator/flex/whiteboard/tink/progress/src/manifest.xml Sun Jun 3 17:43:53 2012
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<componentPackage>
+
+ <!-- controls -->
+ <component id="ProgressIndicator" class="ws.tink.spark.controls.ProgressIndicator"/>
+ <component id="ProgressResize" class="ws.tink.spark.controls.ProgressResize"/>
+ <component id="ProgressWedge" class="ws.tink.spark.controls.ProgressWedge"/>
+
+ <!-- layouts -->
+ <component id="EllipseLayout" class="ws.tink.spark.layouts.EllipseLayout"/>
+ <component id="ProgressLayout" class="ws.tink.spark.layouts.ProgressLayout"/>
+
+ <!-- primitives -->
+ <component id="Wedge" class="ws.tink.spark.primitives.Wedge"/>
+
+</componentPackage>
\ No newline at end of file
Propchange: incubator/flex/whiteboard/tink/progress/src/manifest.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressIndicator.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressIndicator.as?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressIndicator.as (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressIndicator.as Sun Jun 3 17:43:53 2012
@@ -0,0 +1,233 @@
+package ws.tink.spark.controls
+{
+ import spark.components.Label;
+ import spark.components.supportClasses.SkinnableComponent;
+
+ import ws.tink.spark.controls.supportClasses.IProgress;
+
+ public class ProgressIndicator extends SkinnableComponent
+ {
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function ProgressIndicator()
+ {
+ super();
+
+ labelFunction = defaultLabelFunction;
+ }
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Skin Parts
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // progressDisplay
+ //----------------------------------
+
+ [SkinPart(required="false")]
+
+ /**
+ * progressLayout.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public var progressDisplay:IProgress;
+
+
+ //----------------------------------
+ // labelDisplay
+ //----------------------------------
+
+ [SkinPart(required="false")]
+
+ /**
+ * labelDisplay.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public var labelDisplay:Label;
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // total
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for total.
+ */
+ private var _total:Number ;
+
+ /**
+ * total
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get total():Number
+ {
+ return _total;
+ }
+ /**
+ * @private
+ */
+ public function set total( value:Number ):void
+ {
+ if( _total == value ) return;
+
+ _total = value;
+ invalidateProperties();
+ }
+
+
+ //----------------------------------
+ // value
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for value.
+ */
+ private var _value:Number;
+
+ /**
+ * value
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get value():Number
+ {
+ return _value;
+ }
+ /**
+ * @private
+ */
+ public function set value( v:Number):void
+ {
+ if( _value == v ) return;
+
+ _value = v;
+ invalidateProperties();
+ }
+
+
+ //----------------------------------
+ // labelFunction
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for labelFunction.
+ */
+ private var _labelFunction:Function;
+
+ /**
+ * labelFunction
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get labelFunction():Function
+ {
+ return _labelFunction;
+ }
+ /**
+ * @private
+ */
+ public function set labelFunction( value:Function ):void
+ {
+ if( _labelFunction == value ) return;
+
+ _labelFunction = value !== null ? value : defaultLabelFunction;
+ invalidateProperties();
+ }
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ protected function defaultLabelFunction( value:Number, total:Number ):String
+ {
+ return Math.round( ( value / total ) * 100 ).toString() + "%";
+ }
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Overridden Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ override protected function commitProperties():void
+ {
+ super.commitProperties();
+
+ if( labelDisplay ) labelDisplay.text = labelFunction( value, total );
+ if( progressDisplay ) progressDisplay.percent = Math.round( ( value / total ) * 100 );
+ }
+
+// /**
+// * @private
+// */
+// override protected function partAdded( partName:String, instance:Object ):void
+// {
+// super.partAdded( partName, instance );
+// }
+//
+// /**
+// * @private
+// */
+// override protected function partRemoved( partName:String, instance:Object ):void
+// {
+// super.partRemoved( partName, instance );
+// }
+ }
+}
\ No newline at end of file
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressResize.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressResize.as?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressResize.as (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressResize.as Sun Jun 3 17:43:53 2012
@@ -0,0 +1,291 @@
+package ws.tink.spark.controls
+{
+ import mx.utils.BitFlagUtil;
+
+ import spark.components.supportClasses.SkinnableComponent;
+
+ import ws.tink.spark.controls.supportClasses.IProgress;
+ import ws.tink.spark.layouts.ProgressLayout;
+
+ public class ProgressResize extends SkinnableComponent implements IProgress
+ {
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Class constants
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ private static const PERCENT_PROPERTY_FLAG:uint = 1 << 0;
+
+ /**
+ * @private
+ */
+ private static const HORIZONTAL_DIRECTION_PROPERTY_FLAG:uint = 1 << 1;
+
+ /**
+ * @private
+ */
+ private static const VERTICAL_DIRECTION_PROPERTY_FLAG:uint = 1 << 2;
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function ProgressResize()
+ {
+ super();
+ }
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Skin Parts
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // progressLayout
+ //----------------------------------
+
+ [SkinPart(required="true")]
+
+ /**
+ * progressLayout.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public var progressLayout:ProgressLayout;
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Variables
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ * Several properties are proxied to progressLayout. However, when progressLayout
+ * is not around, we need to store values set on ProgressBar. This object
+ * stores those values. If progressLayout is around, the values are stored
+ * on the dataGroup directly. However, we need to know what values
+ * have been set by the developer on the ProgressBar (versus set on
+ * the progressLayout or defaults of the progressLayout) as those are values
+ * we want to carry around if the progressLayout changes (via a new skin).
+ * In order to store this info effeciently, progressLayoutProperties becomes
+ * a uint to store a series of BitFlags. These bits represent whether a
+ * property has been explicitly set on this ProgressBar. When the
+ * progressLayout is not around, progressLayoutProperties is a typeless
+ * object to store these proxied properties. When progressLayout is around,
+ * progressLayoutProperties stores booleans as to whether these properties
+ * have been explicitly set or not.
+ */
+ private var _progressLayoutProperties:Object = {};
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // percent
+ //----------------------------------
+
+ /**
+ * @inheritDoc
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get percent():Number
+ {
+ return progressLayout ? progressLayout.percent : _progressLayoutProperties.percent;
+ }
+ /**
+ * @private
+ */
+ public function set percent( value:Number ):void
+ {
+ if( progressLayout )
+ {
+ progressLayout.percent = value;
+ _progressLayoutProperties = BitFlagUtil.update( _progressLayoutProperties as uint,
+ PERCENT_PROPERTY_FLAG, true );
+ }
+ else
+ {
+ _progressLayoutProperties.percent = value;
+ }
+ }
+
+
+ //----------------------------------
+ // horizontalDirection
+ //----------------------------------
+
+ [Inspectable(category="General", enumeration="leftToRight,rightToLeft,center,none", defaultValue="leftToRight")]
+
+ /**
+ * @copy ws.tink.spark.layouts.ProgressLayout#horizontalDirection
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get horizontalDirection():String
+ {
+ return progressLayout ? progressLayout.horizontalDirection : _progressLayoutProperties.horizontalDirection;
+ }
+ /**
+ * @private
+ */
+ public function set horizontalDirection( value:String ):void
+ {
+ if( progressLayout )
+ {
+ progressLayout.horizontalDirection = value;
+ _progressLayoutProperties = BitFlagUtil.update( _progressLayoutProperties as uint,
+ HORIZONTAL_DIRECTION_PROPERTY_FLAG, true );
+ }
+ else
+ {
+ _progressLayoutProperties.horizontalDirection = value;
+ }
+ }
+
+
+ //----------------------------------
+ // verticalDirection
+ //----------------------------------
+
+ [Inspectable(category="General", enumeration="topToBottom,bottomToTop,middle,none", defaultValue="none")]
+
+ /**
+ * @copy ws.tink.spark.layouts.ProgressLayout#verticalDirection
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get verticalDirection():String
+ {
+ return progressLayout ? progressLayout.verticalDirection : _progressLayoutProperties.verticalDirection;
+ }
+ /**
+ * @private
+ */
+ public function set verticalDirection( value:String ):void
+ {
+ if( progressLayout )
+ {
+ progressLayout.verticalDirection = value;
+ _progressLayoutProperties = BitFlagUtil.update( _progressLayoutProperties as uint,
+ VERTICAL_DIRECTION_PROPERTY_FLAG, true );
+ }
+ else
+ {
+ _progressLayoutProperties.verticalDirection = value;
+ }
+ }
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Overridden Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ override protected function partAdded( partName:String, instance:Object ):void
+ {
+ super.partAdded( partName, instance );
+
+ if( instance == progressLayout )
+ {
+ // Copy proxied values from _progressLayoutProperties (if set) to progressLayout.
+ var newProgressLayoutProperties:uint = 0;
+
+ if( !isNaN( _progressLayoutProperties.percent ) )
+ {
+ progressLayout.percent = _progressLayoutProperties.percent;
+ newProgressLayoutProperties = BitFlagUtil.update( newProgressLayoutProperties as uint,
+ PERCENT_PROPERTY_FLAG, true);;
+ }
+
+ if( _progressLayoutProperties.horizontalDirection !== undefined )
+ {
+ progressLayout.horizontalDirection = _progressLayoutProperties.horizontalDirection;
+ newProgressLayoutProperties = BitFlagUtil.update( newProgressLayoutProperties as uint,
+ HORIZONTAL_DIRECTION_PROPERTY_FLAG, true);
+ }
+
+ if( _progressLayoutProperties.verticalDirection !== undefined )
+ {
+ progressLayout.verticalDirection = _progressLayoutProperties.verticalDirection;
+ newProgressLayoutProperties = BitFlagUtil.update( newProgressLayoutProperties as uint,
+ VERTICAL_DIRECTION_PROPERTY_FLAG, true);
+ }
+
+ _progressLayoutProperties = newProgressLayoutProperties;
+ }
+ }
+
+ /**
+ * @private
+ */
+ override protected function partRemoved( partName:String, instance:Object ):void
+ {
+ super.partRemoved( partName, instance );
+
+ if( instance == progressLayout )
+ {
+ // Copy proxied values from progressLayout (if explicitly set) to _progressLayoutProperties.
+ var newProgressLayoutProperties:Object = {};
+
+ if( BitFlagUtil.isSet( _progressLayoutProperties as uint, PERCENT_PROPERTY_FLAG ) )
+ newProgressLayoutProperties.percent = progressLayout.percent;
+
+ if( BitFlagUtil.isSet( _progressLayoutProperties as uint, HORIZONTAL_DIRECTION_PROPERTY_FLAG ) )
+ newProgressLayoutProperties.horizontalDirection = progressLayout.horizontalDirection;
+
+ if( BitFlagUtil.isSet( _progressLayoutProperties as uint, VERTICAL_DIRECTION_PROPERTY_FLAG ) )
+ newProgressLayoutProperties.verticalDirection = progressLayout.verticalDirection;
+
+ _progressLayoutProperties = newProgressLayoutProperties;
+ }
+ }
+ }
+}
\ No newline at end of file
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressWedge.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressWedge.as?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressWedge.as (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/ProgressWedge.as Sun Jun 3 17:43:53 2012
@@ -0,0 +1,251 @@
+package ws.tink.spark.controls
+{
+ import mx.utils.BitFlagUtil;
+
+ import spark.components.supportClasses.SkinnableComponent;
+
+ import ws.tink.spark.controls.supportClasses.IProgress;
+ import ws.tink.spark.layouts.ProgressLayout;
+ import ws.tink.spark.layouts.supportClasses.RadialDirection;
+ import ws.tink.spark.primitives.Wedge;
+
+ public class ProgressWedge extends SkinnableComponent implements IProgress
+ {
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Class constants
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ private static const PERCENT_PROPERTY_FLAG:uint = 1 << 0;
+
+ /**
+ * @private
+ */
+ private static const HORIZONTAL_DIRECTION_PROPERTY_FLAG:uint = 1 << 1;
+
+ /**
+ * @private
+ */
+ private static const VERTICAL_DIRECTION_PROPERTY_FLAG:uint = 1 << 2;
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function ProgressWedge()
+ {
+ super();
+ }
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Skin Parts
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // wedge
+ //----------------------------------
+
+ [SkinPart(required="true")]
+
+ /**
+ * progressLayout.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public var wedge:Wedge;
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // percent
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for percent.
+ */
+ private var _percent:Number;
+
+ /**
+ * @inheritDoc
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get percent():Number
+ {
+ return _percent;
+ }
+ /**
+ * @private
+ */
+ public function set percent( value:Number ):void
+ {
+ if( _percent == value ) return;
+
+ _percent = value;
+ invalidateProperties();
+ }
+
+
+ //----------------------------------
+ // direction
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for direction.
+ */
+ private var _direction:String = RadialDirection.CLOCKWISE;
+
+ [Inspectable(category="General", enumeration="clockwise,antiClockwise,", defaultValue="clockwise")]
+
+ /**
+ * @copy ws.tink.spark.layouts.ProgressLayout#horizontalDirection
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get direction():String
+ {
+ return _direction;
+ }
+ /**
+ * @private
+ */
+ public function set direction( value:String ):void
+ {
+ if( _direction == value ) return;
+
+ _direction = value;
+ invalidateProperties();
+ }
+
+
+ //----------------------------------
+ // startAngle
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for startAngle.
+ */
+ private var _startAngle:Number = 0;
+
+ /**
+ * startAngle
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get startAngle():Number
+ {
+ return _startAngle;
+ }
+ /**
+ * @private
+ */
+ public function set startAngle(value:Number):void
+ {
+ if( _startAngle == value ) return;
+
+ _startAngle = value;
+ invalidateProperties();
+ }
+
+
+ //----------------------------------
+ // arc
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for arc.
+ */
+ private var _arc:Number = 360;
+
+ /**
+ * arc
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get arc():Number
+ {
+ return _arc;
+ }
+ /**
+ * @private
+ */
+ public function set arc(value:Number):void
+ {
+ if( _arc == value ) return;
+
+ _arc = value;
+ invalidateProperties();
+ }
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Overridden Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ override protected function commitProperties():void
+ {
+ super.commitProperties();
+
+ if( wedge )
+ {
+ wedge.startAngle = startAngle;
+ wedge.arc = ( arc / 100 ) * percent;
+ }
+ }
+
+ }
+}
\ No newline at end of file
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/supportClasses/IProgress.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/supportClasses/IProgress.as?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/supportClasses/IProgress.as (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/controls/supportClasses/IProgress.as Sun Jun 3 17:43:53 2012
@@ -0,0 +1,24 @@
+package ws.tink.spark.controls.supportClasses
+{
+ public interface IProgress
+ {
+
+ //----------------------------------
+ // percent
+ //----------------------------------
+
+ /**
+ * Percent value from 0 to 100 indicating the amount of progress.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ function get percent():Number;
+ /**
+ * @private
+ */
+ function set percent( value:Number ):void;
+ }
+}
\ No newline at end of file
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/EllipseLayout.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/EllipseLayout.as?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/EllipseLayout.as (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/EllipseLayout.as Sun Jun 3 17:43:53 2012
@@ -0,0 +1,257 @@
+package ws.tink.spark.layouts
+{
+ import flash.geom.Matrix;
+ import flash.geom.Point;
+ import flash.geom.Vector3D;
+
+ import mx.core.ILayoutElement;
+
+ import spark.layouts.supportClasses.LayoutBase;
+
+ public class EllipseLayout extends LayoutBase
+ {
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function EllipseLayout()
+ {
+ super();
+ }
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // startAngle
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for startAngle.
+ */
+ private var _startAngle:Number = 0;
+
+ [Inspectable(category="General")]
+ /**
+ * startAngle
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get startAngle():Number
+ {
+ return _startAngle;
+ }
+ /**
+ * @private
+ */
+ public function set startAngle( value:Number ):void
+ {
+ if( _startAngle == value ) return;
+
+ _startAngle = value;
+ invalidateDisplayList();
+ }
+
+
+ //----------------------------------
+ // endAngle
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for endAngle.
+ */
+ private var _endAngle:Number = 0;
+
+ [Inspectable(category="General")]
+ /**
+ * endAngle
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get endAngle():Number
+ {
+ return _endAngle;
+ }
+ /**
+ * @private
+ */
+ public function set endAngle( value:Number ):void
+ {
+ if( _endAngle == value ) return;
+
+ _endAngle = value;
+ invalidateDisplayList();
+ }
+
+
+ //----------------------------------
+ // position
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for position.
+ */
+ private var _position:String = "inset";
+
+ [Inspectable(category="General")]
+ /**
+ * @private
+ * Storage property for position.
+ */
+ public function get position():String
+ {
+ return _position;
+ }
+ /**
+ * @private
+ */
+ public function set position( value:String ):void
+ {
+ if( _position == value ) return;
+
+ _position = value;
+ invalidateDisplayList();
+ }
+
+ public var rotate:Boolean = false;
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ private function updateDisplayListVirtual( width:Number, height:Number ):void
+ {
+
+
+
+
+ }
+
+ /**
+ * @private
+ */
+ private function distance( x1:Number, y1:Number, x2:Number, y2:Number ):Number
+ {
+ const dx:Number = x2 - x1;
+ const dy:Number = y2 - y1;
+ return Math.sqrt( dx * dx + dy * dy );
+ }
+
+ /**
+ * @private
+ */
+ private function invalidateDisplayList():void
+ {
+ if( !target ) return;
+
+ target.invalidateDisplayList();
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Overridden Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ override public function updateDisplayList(width:Number, height:Number):void
+ {
+ super.updateDisplayList(width,height);
+
+ if( !target ) return;
+
+ var element:ILayoutElement;
+ const numElements:int = target.numElements;
+ const angle:Number = 360 / numElements;
+ const radiusX:Number = width / 2;
+ const radiusY:Number = height / 2;
+ var a:Number = startAngle;
+ for (var i:int = 0; i < numElements; i++)
+ {
+ a = startAngle + ( angle * i );
+ element = target.getElementAt( i );
+ element.setLayoutBoundsSize( element.getPreferredBoundsWidth(), element.getPreferredBoundsHeight() );
+ if( rotate )
+ {
+ element.transformAround( new Vector3D( element.getPreferredBoundsWidth() / 2, radiusY, 0 ),
+ null,
+ new Vector3D( 0, 0, a ),
+ new Vector3D( radiusX, radiusY, 0 ) );
+ }
+ else
+ {
+ element.setLayoutBoundsPosition( radiusX + ( radiusX * Math.cos(a * ( Math.PI / 180 ) ) ) - ( element.getPreferredBoundsWidth() / 2 ),
+ radiusY + ( radiusY * Math.sin(a * ( Math.PI / 180 ) ) ) - ( element.getPreferredBoundsHeight() / 2 ) );
+ }
+ // switch( position )
+ // {
+ // case "inset" :
+ // {
+ //
+ // break;
+ // }
+ // default :
+ // {
+ //
+ //
+ // }
+ // }
+
+ // var m:Matrix = new Matrix();
+ // m.tx = radiusX + ( radiusX * Math.cos(a * ( Math.PI / 180 ) ) ) - ( element.getPreferredBoundsWidth() / 2 );
+ // m.ty = radiusY + ( radiusY * Math.sin(a * ( Math.PI / 180 ) ) ) - ( element.getPreferredBoundsHeight() / 2 );
+ // m.rotate( a * ( Math.PI / 180 ) );
+ // m.tx = m.ty = 200;
+ // m.tx = radiusX + ( radiusX * Math.cos(a * ( Math.PI / 180 ) ) ) - ( element.getPreferredBoundsWidth() / 2 );
+ // m.ty = radiusY + ( radiusY * Math.sin(a * ( Math.PI / 180 ) ) ) - ( element.getPreferredBoundsHeight() / 2 );
+ // element.setLayoutMatrix( m, false );
+
+ // var x:Number = radiusX + ( radiusX * Math.cos(a * ( Math.PI / 180 ) ) );
+ // var y:Number = radiusY + ( radiusY * Math.cos(a * ( Math.PI / 180 ) ) );
+ //
+ //
+ // trace( i, distance( radiusX, radiusY, x, y ), x, y, radiusX, radiusY );
+
+
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/ProgressLayout.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/ProgressLayout.as?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/ProgressLayout.as (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/ProgressLayout.as Sun Jun 3 17:43:53 2012
@@ -0,0 +1,263 @@
+package ws.tink.spark.layouts
+{
+ import mx.core.IVisualElement;
+
+ import spark.layouts.BasicLayout;
+ import ws.tink.spark.layouts.supportClasses.HorizontalDirection;
+ import ws.tink.spark.layouts.supportClasses.VerticalDirection;
+
+ public class ProgressLayout extends BasicLayout
+ {
+ public function ProgressLayout()
+ {
+ super();
+ }
+
+ //----------------------------------
+ // progressItems
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for progressItems.
+ */
+ private var _progressItems:Array;
+
+ /**
+ * progressItems
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get progressItems():Array
+ {
+ return _progressItems;
+ }
+ /**
+ * @private
+ */
+ public function set progressItems(value:Array):void
+ {
+ if( _progressItems == value ) return;
+
+ _progressItems = value;
+ invalidateDisplayList();
+ }
+
+
+ //----------------------------------
+ // horizontalDirection
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for horizontalDirection.
+ */
+ private var _horizontalDirection:String = HorizontalDirection.LEFT_TO_RIGHT;
+
+ [Inspectable(category="General", enumeration="leftToRight,rightToLeft,center,none", defaultValue="leftToRight")]
+ /**
+ * horizontalDirection
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get horizontalDirection():String
+ {
+ return _horizontalDirection;
+ }
+ /**
+ * @private
+ */
+ public function set horizontalDirection(value:String):void
+ {
+ if( _horizontalDirection == value ) return;
+
+ _horizontalDirection = value;
+ invalidateDisplayList();
+ }
+
+
+ //----------------------------------
+ // verticalDirection
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for verticalDirection.
+ */
+ private var _verticalDirection:String = VerticalDirection.NONE;
+
+ [Inspectable(category="General", enumeration="topToBottom,bottomToTop,middle,none", defaultValue="none")]
+ /**
+ * verticalDirection
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get verticalDirection():String
+ {
+ return _verticalDirection;
+ }
+ /**
+ * @private
+ */
+ public function set verticalDirection(value:String):void
+ {
+ if( _verticalDirection == value ) return;
+
+ _verticalDirection = value;
+ invalidateDisplayList();
+ }
+
+
+ //----------------------------------
+ // percent
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage property for percent.
+ */
+ private var _percent:Number = 0;
+
+ /**
+ * percent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get percent():Number
+ {
+ return _percent;
+ }
+ /**
+ * @private
+ */
+ public function set percent(value:Number):void
+ {
+ if( _percent == value ) return;
+
+ _percent = value;
+ invalidateDisplayList();
+ }
+
+
+ /**
+ * @private
+ */
+ private function invalidateDisplayList():void
+ {
+ if( !target ) return;
+ target.invalidateDisplayList();
+ }
+
+ /**
+ * @private
+ */
+ override public function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void
+ {
+ super.updateDisplayList( unscaledWidth, unscaledHeight );
+
+ if( progressItems && progressItems.length )
+ {
+ var element:IVisualElement;
+ var originalSize:Number;
+ var originalPos:Number;
+ var minSize:Number;
+ var availableChange:Number;
+ var newWidth:Number;
+ var newHeight:Number;
+ var newX:Number;
+ var newY:Number;
+
+ for each (var item:Object in progressItems)
+ {
+ if( item is IVisualElement )
+ {
+ element = IVisualElement( item );
+
+ originalSize = element.getLayoutBoundsWidth();
+ originalPos = element.getLayoutBoundsX();
+
+ if( horizontalDirection == HorizontalDirection.NONE )
+ {
+ newWidth = originalSize;
+ newX = originalPos;
+ }
+ else
+ {
+ minSize = element.getMinBoundsWidth();
+ availableChange = originalSize - minSize;
+ newWidth = Math.round( minSize + ( availableChange * ( percent / 100 ) ) );
+
+ switch( horizontalDirection )
+ {
+ case HorizontalDirection.RIGHT_TO_LEFT :
+ {
+ newX = ( originalPos + originalSize ) - newWidth;
+ break;
+ }
+ case HorizontalDirection.CENTER :
+ {
+ newX = ( originalPos + ( originalSize / 2 ) ) - ( newWidth / 2 );
+ break;
+ }
+ default :
+ {
+ newX = originalPos;
+ break;
+ }
+ }
+ }
+
+ originalSize = element.getLayoutBoundsHeight();
+ originalPos = element.getLayoutBoundsY();
+
+ if( verticalDirection == VerticalDirection.NONE )
+ {
+ newHeight = originalSize;
+ newY = originalPos;
+ }
+ else
+ {
+ minSize = element.getMinBoundsHeight();
+ availableChange = originalSize - minSize;
+ newHeight = Math.round( minSize + ( availableChange * ( percent / 100 ) ) );
+
+ switch( verticalDirection )
+ {
+ case VerticalDirection.BOTTOM_TO_TOP :
+ {
+ newY = ( originalPos + originalSize ) - newHeight;
+ break;
+ }
+ case VerticalDirection.MIDDLE :
+ {
+ newY = ( originalPos + ( originalSize / 2 ) ) - ( newHeight / 2 );
+ break;
+ }
+ default :
+ {
+ newY = originalPos;
+ break;
+ }
+ }
+ }
+
+ element.setLayoutBoundsSize( newWidth, newHeight );
+ element.setLayoutBoundsPosition( newX, newY );
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/HorizontalDirection.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/HorizontalDirection.as?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/HorizontalDirection.as (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/HorizontalDirection.as Sun Jun 3 17:43:53 2012
@@ -0,0 +1,46 @@
+package ws.tink.spark.layouts.supportClasses
+{
+ public class HorizontalDirection
+ {
+
+ /**
+ * Resize the children from left to right.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static const LEFT_TO_RIGHT:String = "leftToRight";
+
+ /**
+ * Resize the children from right to left.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static const RIGHT_TO_LEFT:String = "rightToLeft";
+
+ /**
+ * Do not resize the children.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static const NONE:String = "none";
+
+ /**
+ * Resize the children from the center.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static const CENTER:String = "center";
+ }
+}
\ No newline at end of file
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/RadialDirection.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/RadialDirection.as?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/RadialDirection.as (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/RadialDirection.as Sun Jun 3 17:43:53 2012
@@ -0,0 +1,27 @@
+package ws.tink.spark.layouts.supportClasses
+{
+ public class RadialDirection
+ {
+
+ /**
+ * Resize the children from left to right.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static const CLOCKWISE:String = "clockwise";
+
+ /**
+ * Resize the children from right to left.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static const ANTI_CLOCKWISE:String = "antiClockwise";
+
+ }
+}
\ No newline at end of file
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/VerticalDirection.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/VerticalDirection.as?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/VerticalDirection.as (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/layouts/supportClasses/VerticalDirection.as Sun Jun 3 17:43:53 2012
@@ -0,0 +1,45 @@
+package ws.tink.spark.layouts.supportClasses
+{
+ public class VerticalDirection
+ {
+ /**
+ * Resize the children from top to bottom.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static const TOP_TO_BOTTOM:String = "topToBottom";
+
+ /**
+ * Resize the children from bottom to top.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static const BOTTOM_TO_TOP:String = "bottomToTop";
+
+ /**
+ * Do not resize the children.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static const NONE:String = "none";
+
+ /**
+ * Resize the children from the middle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static const MIDDLE:String = "middle";
+ }
+}
\ No newline at end of file
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/primitives/Wedge.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/primitives/Wedge.as?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/primitives/Wedge.as (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/primitives/Wedge.as Sun Jun 3 17:43:53 2012
@@ -0,0 +1,324 @@
+
+package ws.tink.spark.primitives
+{
+ import flash.display.Graphics;
+
+ import spark.primitives.supportClasses.FilledElement;
+
+
+
+ public class Wedge extends FilledElement
+ {
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function Wedge()
+ {
+ super();
+ }
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //-----------------------
+ // startAngle
+ //-----------------------
+
+ private var _startAngle:Number;
+
+ /**
+ * The beginning angle of the arc. If not specified
+ * a default value of 0 is used.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get startAngle():Number
+ {
+ if (!_startAngle)
+ {
+ return 0;
+ }
+ return _startAngle;
+ }
+
+ /**
+ * @private
+ */
+ public function set startAngle(value:Number):void
+ {
+ if (_startAngle != value)
+ {
+ _startAngle = value;
+
+ invalidateSize();
+ invalidateDisplayList();
+ invalidateParentSizeAndDisplayList();
+ }
+ }
+
+
+
+ //-----------------------
+ // arc
+ //-----------------------
+
+ private var _arc:Number;
+
+ /**
+ * The angular extent of the arc. If not specified
+ * a default value of 0 is used.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function get arc():Number
+ {
+ if (!_arc)
+ {
+ return 0;
+ }
+ return _arc;
+ }
+
+ /**
+ * @private
+ */
+ public function set arc(value:Number):void
+ {
+ if (_arc != value)
+ {
+ _arc = value;
+
+ invalidateSize();
+ invalidateDisplayList();
+ invalidateParentSizeAndDisplayList();
+ }
+ }
+
+
+
+ //-----------------------
+ // closureType
+ //-----------------------
+
+ private var _closureType:String;
+
+ [Inspectable(category="General",enumeration="open,chord,pie",defaultValue="open")]
+
+ /**
+ * The method in which to close the arc.
+ * <p>
+ * <li><b>open</b> will apply no closure.</li>
+ * <li><b>chord</b> will close the arc with a strait line to the start.</li>
+ * <li><b>pie</b> will draw a line from center to start and end to center forming a pie shape.</li>
+ * </p>
+ **/
+ public function get closureType():String
+ {
+ if (!_closureType)
+ {
+ return "open";
+ }
+ return _closureType;
+ }
+
+ public function set closureType(value:String):void
+ {
+ if (_closureType != value)
+ {
+ _closureType = value;
+
+ invalidateSize();
+ invalidateDisplayList();
+ invalidateParentSizeAndDisplayList();
+ }
+ }
+
+
+
+
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Overridden methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @inheritDoc
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ override protected function draw(g:Graphics):void
+ {
+ if( Math.abs( arc ) >= 360 )
+ {
+ g.drawEllipse( x, y, width, height );
+ }
+ else
+ {
+ const segments:uint = Math.ceil( Math.abs( arc ) / 45 );
+ if( segments == 0 ) return;
+
+ var radians:Number = startAngle * ( Math.PI / 180 );
+ const radiusX:Number = width / 2;
+ const radiusY:Number = height / 2;
+
+ var sx:Number = radiusX + ( radiusX * Math.cos( radians ) );
+ var sy:Number = radiusY + ( radiusY * Math.sin( radians ) );
+
+ //draw the start line in the case of a pie type
+ if (closureType == "pie")
+ {
+ g.moveTo( x + radiusX, y + radiusY );
+ g.lineTo( x + sx, y + sy );
+ }
+ else
+ {
+ g.moveTo( x + sx, y + sy );
+ }
+
+
+ // Now calculate the sweep of each segment
+ const angleDelta:Number = arc / segments;
+
+ const radiansDelta:Number = angleDelta * ( Math.PI / 180 );
+ const halfRadiansDelta:Number = radiansDelta / 2;
+
+ var px:Number;
+ var py:Number;
+ var cx:Number;
+ var cy:Number;
+
+ // Loop for drawing arc segments
+ for( var i:int = 0; i < segments; i++)
+ {
+ radians += radiansDelta;
+
+ px = radiusX + ( radiusX * Math.cos( radians ) );
+ py = radiusY + ( radiusY * Math.sin( radians ) );
+
+ cx = radiusX + Math.cos(radians - halfRadiansDelta ) * (radiusX / Math.cos( halfRadiansDelta ) );
+ cy = radiusY + Math.sin(radians - halfRadiansDelta ) * (radiusY / Math.cos( halfRadiansDelta ) );
+
+ g.curveTo( x + cx, y + cy, x + px, y + py);
+ }
+
+
+ // close the arc if required
+ if (closureType == "pie")
+ {
+ g.lineTo( x + radiusX, y + radiusY );
+ }
+ else if (closureType == "chord")
+ {
+ g.lineTo( sx, sy );
+ }
+
+ }
+ }
+
+
+
+
+// /**
+// * @private
+// */
+// protected static function drawEllipticalArc(x:Number, y:Number, startAngle:Number, arc:Number, radius:Number,
+// yRadius:Number, g:Graphics):void
+// {
+//
+// var ax:Number;
+// var ay:Number;
+//
+// // Circumvent drawing more than is needed
+// if (Math.abs(arc) > 360)
+// {
+// arc = 360;
+// }
+//
+// // Draw in a maximum of 45 degree segments. First we calculate how many
+// // segments are needed for our arc.
+// var segs:Number = Math.ceil(Math.abs(arc) / 45);
+//
+// // Now calculate the sweep of each segment
+// var segAngle:Number = arc / segs;
+//
+// // The math requires radians rather than degrees. To convert from degrees
+// // use the formula (degrees/180)*Math.PI to get radians.
+// var theta:Number = (segAngle / 180) * Math.PI;
+//
+// // convert angle startAngle to radians
+// var angle:Number = (startAngle / 180) * Math.PI;
+//
+// // find our starting points (ax,ay) relative to the secified x,y
+// ax = x - Math.cos(angle) * radius;
+// ay = y - Math.sin(angle) * yRadius;
+//
+// trace( Math.cos(angle) * radius, Math.sin(angle) * yRadius, "x", x, "y", y, radius, yRadius );
+//
+// // Draw as 45 degree segments
+// if (segs > 0)
+// {
+// var oldX:Number = x;
+// var oldY:Number = y;
+// var cx:Number;
+// var cy:Number;
+// var x1:Number;
+// var y1:Number;
+//
+// // Loop for drawing arc segments
+// for (var i:int = 0; i < segs; i++)
+// {
+//
+// // increment our angle
+// angle += theta;
+//
+// //find the angle halfway between the last angle and the new one,
+// //calculate our end point, our control point, and draw the arc segment
+//
+// cx = ax + Math.cos(angle - (theta / 2)) * (radius / Math.cos(theta / 2));
+//
+// cy = ay + Math.sin(angle - (theta / 2)) * (yRadius / Math.cos(theta / 2));
+//
+// x1 = ax + Math.cos(angle) * radius;
+//
+// y1 = ay + Math.sin(angle) * yRadius;
+//
+// g.curveTo(cx, cy, x1, y1);
+//
+// oldX = x1;
+// oldY = y1;
+// }
+// }
+// }
+
+ }
+}
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressIndicatorResizeSkin.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressIndicatorResizeSkin.mxml?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressIndicatorResizeSkin.mxml (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressIndicatorResizeSkin.mxml Sun Jun 3 17:43:53 2012
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:st="library://ns.tink.ws/flex/spark"
+ minWidth="100">
+
+ <fx:Metadata>
+ <![CDATA[
+ /**
+ * @copy spark.skins.spark.ApplicationSkin#hostComponent
+ */
+ [HostComponent("ws.tink.spark.controls.ProgressIndicator")]
+ ]]>
+ </fx:Metadata>
+
+ <s:layout>
+ <s:HorizontalLayout verticalAlign="middle"/>
+ </s:layout>
+
+ <!--- @copy ws.tink.spark.controls.ProgressIndicator#progressDisplay -->
+ <st:ProgressResize id="progressDisplay" width="100%"/>
+
+ <!--- @copy ws.tink.spark.controls.ProgressIndicator#labelDisplay -->
+ <s:Label id="labelDisplay"/>
+
+</s:Skin>
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressIndicatorWedgeSkin.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressIndicatorWedgeSkin.mxml?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressIndicatorWedgeSkin.mxml (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressIndicatorWedgeSkin.mxml Sun Jun 3 17:43:53 2012
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:st="library://ns.tink.ws/flex/spark">
+
+ <fx:Metadata>
+ <![CDATA[
+ /**
+ * @copy spark.skins.spark.ApplicationSkin#hostComponent
+ */
+ [HostComponent("ws.tink.spark.controls.ProgressIndicator")]
+ ]]>
+ </fx:Metadata>
+
+
+ <!--- @copy ws.tink.spark.controls.ProgressIndicator#progressDisplay -->
+ <st:ProgressWedge id="progressDisplay" width="100%" height="100%" startAngle="-90"
+ direction="antiClockwise"/>
+
+ <!--- @copy ws.tink.spark.controls.ProgressIndicator#labelDisplay -->
+ <s:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
+
+</s:Skin>
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressResizeSkin.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressResizeSkin.mxml?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressResizeSkin.mxml (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressResizeSkin.mxml Sun Jun 3 17:43:53 2012
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:st="library://ns.tink.ws/flex/spark"
+ minWidth="20" minHeight="7">
+
+ <fx:Metadata>
+ <![CDATA[
+ /**
+ * @copy spark.skins.spark.ApplicationSkin#hostComponent
+ */
+ [HostComponent("ws.tink.spark.controls.ProgressResize")]
+ ]]>
+ </fx:Metadata>
+
+ <fx:Script>
+ /**
+ * @private
+ */
+ override protected function initializationComplete():void
+ {
+ useChromeColor = true;
+ super.initializationComplete();
+ }
+ </fx:Script>
+
+ <s:layout>
+ <st:ProgressLayout id="progressLayout" progressItems="{[bar]}"/>
+ </s:layout>
+
+ <!-- border -->
+ <!--- @private -->
+ <s:Rect id="border" left="0" right="0" top="0" bottom="0">
+ <s:fill>
+ <s:SolidColor color="0x636363"/>
+ </s:fill>
+ </s:Rect>
+
+ <!-- background -->
+ <!--- @private -->
+ <s:Rect id="background" left="1" right="1" top="1" bottom="1">
+ <s:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="0x868686"/>
+ <s:GradientEntry color="0xB5B5B5" />
+ </s:LinearGradient>
+ </s:fill>
+ </s:Rect>
+
+ <!-- bar -->
+ <!--- @private -->
+ <s:Group id="bar" left="0" right="0" top="0" bottom="0" minWidth="1">
+
+ <!-- bar border -->
+ <!--- @private -->
+ <s:Rect width="100%" height="100%">
+ <s:fill>
+ <s:SolidColor color="0x636363"/>
+ </s:fill>
+ </s:Rect>
+
+ <!-- bar fill -->
+ <!--- @private -->
+ <s:Rect left="1" right="1" top="1" bottom="1">
+ <s:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="0xFFFFFF"/>
+ <s:GradientEntry color="0xD8D8D8" />
+ </s:LinearGradient>
+ </s:fill>
+ </s:Rect>
+
+ </s:Group>
+</s:SparkSkin>
Added: incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressWedgeSkin.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressWedgeSkin.mxml?rev=1345721&view=auto
==============================================================================
--- incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressWedgeSkin.mxml (added)
+++ incubator/flex/whiteboard/tink/progress/src/ws/tink/spark/skins/controls/ProgressWedgeSkin.mxml Sun Jun 3 17:43:53 2012
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:st="library://ns.tink.ws/flex/spark"
+ minWidth="50" minHeight="50">
+
+ <fx:Metadata>
+ <![CDATA[
+ /**
+ * @copy spark.skins.spark.ApplicationSkin#hostComponent
+ */
+ [HostComponent("ws.tink.spark.controls.ProgressWedge")]
+ ]]>
+ </fx:Metadata>
+
+ <fx:Script>
+ /**
+ * @private
+ */
+ override protected function initializationComplete():void
+ {
+ useChromeColor = true;
+ super.initializationComplete();
+ }
+ </fx:Script>
+
+ <s:Ellipse width="100%" height="100%">
+ <s:filters>
+ <s:DropShadowFilter color="0x000000" alpha="0.5" inner="true" angle="90"
+ distance="1" blurX="7" blurY="7"/>
+ </s:filters>
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="0x636363"/>
+ </s:stroke>
+ <s:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="0x868686"/>
+ <s:GradientEntry color="0xB5B5B5" />
+ </s:LinearGradient>
+ </s:fill>
+ </s:Ellipse>
+
+ <!--- @copy ws.tink.spark.controls.ProgressPie#wedge -->
+ <st:Wedge id="wedge" closureType="pie"
+ width="100%" height="100%">
+ <st:stroke>
+ <s:SolidColorStroke weight="1" color="0x636363"/>
+ </st:stroke>
+ <st:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="0xFFFFFF"/>
+ <s:GradientEntry color="0xD8D8D8" />
+ </s:LinearGradient>
+ </st:fill>
+ </st:Wedge>
+
+</s:SparkSkin>