flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [47/50] git commit: [flex-asjs] [refs/heads/feature/mdl] - Add currentBuffer property to ProgressBar
Date Mon, 19 Dec 2016 02:18:35 GMT
Add currentBuffer property to ProgressBar


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/aa30cc97
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/aa30cc97
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/aa30cc97

Branch: refs/heads/feature/mdl
Commit: aa30cc97a8c5fbf59287581892a5d4e109dfc2b1
Parents: c66874a
Author: piotrz <piotrz@apache.org>
Authored: Sun Dec 18 16:54:45 2016 +0100
Committer: piotrz <piotrz@apache.org>
Committed: Sun Dec 18 16:54:45 2016 +0100

----------------------------------------------------------------------
 .../MDLExample/src/main/flex/Loading.mxml       |  3 ++
 .../flex/org/apache/flex/mdl/ProgressBar.as     | 54 +++++++++++++++++---
 2 files changed, 51 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/aa30cc97/examples/flexjs/MDLExample/src/main/flex/Loading.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/Loading.mxml b/examples/flexjs/MDLExample/src/main/flex/Loading.mxml
index fa20b75..7cccd7e 100644
--- a/examples/flexjs/MDLExample/src/main/flex/Loading.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/Loading.mxml
@@ -30,6 +30,9 @@ limitations under the License.
             <mdl:ProgressBar currentProgress="47" />
         </mdl:GridCell>
         <mdl:GridCell column="1">
+            <mdl:ProgressBar currentProgress="47" currentBuffer="25"/>
+        </mdl:GridCell>
+        <mdl:GridCell column="1">
             <mdl:ProgressBar currentProgress="47" indeterminate="true"/>
         </mdl:GridCell>
     </mdl:Grid>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/aa30cc97/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/ProgressBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/ProgressBar.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/ProgressBar.as
index 247c08e..1f18bc2 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/ProgressBar.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/ProgressBar.as
@@ -37,6 +37,7 @@ package org.apache.flex.mdl
     public class ProgressBar
     {
         private var _currentProgress:Number;
+        private var _currentBuffer:Number;
         private var _indeterminate:Boolean;
 
         /**
@@ -57,6 +58,24 @@ package org.apache.flex.mdl
             _currentProgress = value;
         }
 
+        /**
+         *  Current progress of the buffer.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get currentBuffer():Number
+        {
+            return _currentBuffer;
+        }
+
+        public function set currentBuffer(value:Number):void
+        {
+            _currentBuffer = value;
+        }
+
         public function set indeterminate(value:Boolean):void
         {
             _indeterminate = value;
@@ -66,8 +85,6 @@ package org.apache.flex.mdl
     COMPILE::JS
     public class ProgressBar extends UIBase
     {
-        private const MaterialProgress:String = "MaterialProgress";
-
         public function ProgressBar()
         {
             super();
@@ -75,8 +92,10 @@ package org.apache.flex.mdl
             className = "";
         }
 
-        private var _materialProgress:Object;
+        private var materialProgress:Object;
+
         private var _currentProgress:Number;
+        private var _currentBuffer:Number;
         private var _indeterminate:Boolean;
 
         public function get currentProgress():Number
@@ -91,6 +110,18 @@ package org.apache.flex.mdl
             setCurrentProgress(value);
         }
 
+        public function get currentBuffer():Number
+        {
+            return _currentBuffer;
+        }
+
+        public function set currentBuffer(value:Number):void
+        {
+            _currentBuffer = value;
+
+            setCurrentProgress(value);
+        }
+
         public function set indeterminate(value:Boolean):void
         {
             _indeterminate = value;
@@ -117,17 +148,28 @@ package org.apache.flex.mdl
 
         private function setCurrentProgress(value:Number):void
         {
-            if (_materialProgress && !_indeterminate)
+            if (materialProgress && !_indeterminate)
             {
-                _materialProgress.setProgress(value);
+                materialProgress.setProgress(value);
+            }
+        }
+
+        private function setCurrentBuffer(value:Number):void
+        {
+            if (materialProgress && !_indeterminate)
+            {
+                materialProgress.setBuffer(value);
             }
         }
 
         private function onElementMdlComponentUpgraded(event:Event):void
         {
-            _materialProgress = event.currentTarget[MaterialProgress];
+            if (!event.currentTarget) return;
+
+            materialProgress = event.currentTarget.MaterialProgress;
 
             setCurrentProgress(_currentProgress);
+            setCurrentBuffer(_currentBuffer);
         }
     }
 }


Mime
View raw message