flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject git commit: [flex-asjs] [refs/heads/refactor-sprite] - refactor batch 4
Date Wed, 27 Jul 2016 18:47:11 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/refactor-sprite e976b1fa3 -> 46616874b


refactor batch 4


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

Branch: refs/heads/refactor-sprite
Commit: 46616874b47a8e1fe39988b8dc7262834d917564
Parents: e976b1f
Author: Harbs <harbs@in-tools.com>
Authored: Wed Jul 27 21:47:05 2016 +0300
Committer: Harbs <harbs@in-tools.com>
Committed: Wed Jul 27 21:47:05 2016 +0300

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/core/UIBase.as    |  2 +-
 .../apache/flex/flat/beads/CSSScrollBarView.as  | 42 ++++++++++----------
 .../apache/flex/flat/beads/DropDownListView.as  | 35 ++++++++--------
 3 files changed, 41 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/46616874/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
index 6e74408..7ec2974 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
@@ -1234,7 +1234,7 @@ package org.apache.flex.core
         {
             COMPILE::SWF
             {
-                return sprite.numChildren;
+                return _elements ? _elements.length : 0;
             }
             COMPILE::JS
             {

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/46616874/frameworks/projects/Flat/src/main/flex/org/apache/flex/flat/beads/CSSScrollBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Flat/src/main/flex/org/apache/flex/flat/beads/CSSScrollBarView.as
b/frameworks/projects/Flat/src/main/flex/org/apache/flex/flat/beads/CSSScrollBarView.as
index 38583f6..edcc121 100644
--- a/frameworks/projects/Flat/src/main/flex/org/apache/flex/flat/beads/CSSScrollBarView.as
+++ b/frameworks/projects/Flat/src/main/flex/org/apache/flex/flat/beads/CSSScrollBarView.as
@@ -18,7 +18,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.flat.beads
 {
-	import flash.display.DisplayObject;
 	
     import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IBeadLayout;
@@ -102,7 +101,8 @@ package org.apache.flex.flat.beads
             
             for each (var bead:IBead in beads)
                 addBead(bead);
-                        
+            
+            var host:UIBase = UIBase(value);
 			sbModel = value.getBeadByType(IScrollBarModel) as IScrollBarModel;
             sbModel = _strand.getBeadByType(IScrollBarModel) as IScrollBarModel;
             sbModel.addEventListener("maximumChange", changeHandler);
@@ -119,25 +119,25 @@ package org.apache.flex.flat.beads
             sbView.upArrowShape.className = "vscrollbar-downarrow";
             sbView.downArrowShape.className = "vscrollbar-downarrow";
             sbView.overArrowShape.className = "vscrollbar-downarrow";
-            Button(_increment).addBead(sbView);
-            Button(_increment).addBead(new ButtonAutoRepeatController());
+            _increment.addBead(sbView);
+            _increment.addBead(new ButtonAutoRepeatController());
 			_decrement = new Button();
-            Button(_decrement).className = "vscrollbar-uparrow-btn";
+            _decrement.className = "vscrollbar-uparrow-btn";
             sbView = new CSSScrollBarButtonView();
             sbView.upArrowShape.className = "vscrollbar-uparrow";
             sbView.downArrowShape.className = "vscrollbar-uparrow";
             sbView.overArrowShape.className = "vscrollbar-uparrow";
-            Button(_decrement).addBead(sbView);
-            Button(_decrement).addBead(new ButtonAutoRepeatController());
+            _decrement.addBead(sbView);
+            _decrement.addBead(new ButtonAutoRepeatController());
 			_track = new Button();
-            Button(_track).className = "vscrollbar-track";
+            _track.className = "vscrollbar-track";
 			_thumb = new Button();				
-            Button(_thumb).className = "vscrollbar-thumb";
+            _thumb.className = "vscrollbar-thumb";
             
-            UIBase(value).addElement(_decrement);
-            UIBase(value).addElement(_increment);
-            UIBase(value).addElement(_track);
-            UIBase(value).addElement(_thumb);
+            host.addElement(_decrement);
+            host.addElement(_increment);
+            host.addElement(_track);
+            host.addElement(_thumb);
             
             IEventDispatcher(_strand).addEventListener("heightChanged", changeHandler);
             
@@ -153,10 +153,10 @@ package org.apache.flex.flat.beads
             layout.layout();    
         }
         
-		private var _decrement:DisplayObject;
-		private var _increment:DisplayObject;
-		private var _track:DisplayObject;
-		private var _thumb:DisplayObject;
+		private var _decrement:Button;
+		private var _increment:Button;
+		private var _track:Button;
+		private var _thumb:Button;
 		
         /**
          *  @copy org.apache.flex.html.beads.IScrollBarView#decrement
@@ -166,7 +166,7 @@ package org.apache.flex.flat.beads
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-		public function get decrement():DisplayObject
+		public function get decrement():Button
 		{
 			return _decrement;
 		}
@@ -179,7 +179,7 @@ package org.apache.flex.flat.beads
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-		public function get increment():DisplayObject
+		public function get increment():Button
 		{
 			return _increment;
 		}
@@ -192,7 +192,7 @@ package org.apache.flex.flat.beads
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-		public function get track():DisplayObject
+		public function get track():Button
 		{
 			return _track;
 		}
@@ -205,7 +205,7 @@ package org.apache.flex.flat.beads
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-		public function get thumb():DisplayObject
+		public function get thumb():Button
 		{
 			return _thumb;
 		}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/46616874/frameworks/projects/Flat/src/main/flex/org/apache/flex/flat/beads/DropDownListView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Flat/src/main/flex/org/apache/flex/flat/beads/DropDownListView.as
b/frameworks/projects/Flat/src/main/flex/org/apache/flex/flat/beads/DropDownListView.as
index f7357b9..126bb0b 100644
--- a/frameworks/projects/Flat/src/main/flex/org/apache/flex/flat/beads/DropDownListView.as
+++ b/frameworks/projects/Flat/src/main/flex/org/apache/flex/flat/beads/DropDownListView.as
@@ -22,7 +22,6 @@ package org.apache.flex.flat.beads
 	import flash.display.DisplayObjectContainer;
 	import flash.display.Graphics;
 	import flash.display.Shape;
-	import flash.display.SimpleButton;
 	import flash.display.Sprite;
 	import flash.text.TextFieldType;
 	
@@ -37,9 +36,11 @@ package org.apache.flex.flat.beads
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.IUIBase;
 	import org.apache.flex.core.ValuesManager;
+    import org.apache.flex.core.UIBase;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.html.beads.IDropDownListView;
+    import org.apache.flex.html.Button;
 	import org.apache.flex.utils.CSSUtils;
     
     /**
@@ -76,9 +77,9 @@ package org.apache.flex.flat.beads
 			upTextField = new CSSTextField();
 			downTextField = new CSSTextField();
 			overTextField = new CSSTextField();
-            upSprite.addChild(upTextField);
-            overSprite.addChild(overTextField);
-            downSprite.addChild(downTextField);
+            upSprite.sprite.addChild(upTextField.textField);
+            overSprite.sprite.addChild(overTextField.textField);
+            downSprite.sprite.addChild(downTextField.textField);
 			upTextField.selectable = false;
             upTextField.parentDrawsBackground = true;
             upTextField.parentHandlesPadding = true;
@@ -102,9 +103,9 @@ package org.apache.flex.flat.beads
             overArrows.className = 'dropdown-caret';
             downArrows = new CSSShape();
             downArrows.className = 'dropdown-caret';
-            upSprite.addChild(upArrows);
-			overSprite.addChild(overArrows);
-			downSprite.addChild(downArrows);
+            upSprite.sprite.addChild(upArrows.shape);
+			overSprite.sprite.addChild(overArrows.shape);
+			downSprite.sprite.addChild(downArrows.shape);
 
 		}
 
@@ -123,7 +124,9 @@ package org.apache.flex.flat.beads
          */
 		override public function set strand(value:IStrand):void
 		{
-			super.strand = value;;
+			super.strand = value;
+
+            var b:Button = Button(value);
             selectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
             selectionModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
             selectionModel.addEventListener("dataProviderChanged", selectionChangeHandler);
@@ -131,10 +134,10 @@ package org.apache.flex.flat.beads
 			shape.graphics.beginFill(0xCCCCCC);
 			shape.graphics.drawRect(0, 0, 10, 10);
 			shape.graphics.endFill();
-			SimpleButton(value).upState = upSprite;
-			SimpleButton(value).downState = downSprite;
-			SimpleButton(value).overState = overSprite;
-			SimpleButton(value).hitTestState = shape;
+			b.button.upState = upSprite.sprite;
+			b.button.downState = downSprite.sprite;
+			b.button.overState = overSprite.sprite;
+			b.button.hitTestState = shape;
 			if (selectionModel.selectedIndex !== -1)
 				selectionChangeHandler(null);
             else
@@ -162,8 +165,8 @@ package org.apache.flex.flat.beads
 		
         private function changeHandler(event:Event):void
         {
-            var ww:Number = DisplayObject(_strand).width;
-            var hh:Number = DisplayObject(_strand).height;
+            var ww:Number = IUIBase(_strand).width;
+            var hh:Number = IUIBase(_strand).height;
             var padding:Object = ValuesManager.valuesImpl.getValue(_strand, "padding");
             var paddingLeft:Object = ValuesManager.valuesImpl.getValue(_strand,"padding-left");
             var paddingRight:Object = ValuesManager.valuesImpl.getValue(_strand,"padding-right");
@@ -291,8 +294,8 @@ package org.apache.flex.flat.beads
                 _popUpVisible = value;
                 if (value)
                 {
-					var root:Object = DisplayObject(_strand).root;
-					var host:DisplayObjectContainer = DisplayObject(_strand).parent;
+					var root:Object = UIBase(_strand).sprite.root;
+					var host:DisplayObjectContainer = UIBase(_strand).sprite.parent;
                     while (host && !(host is IPopUpHost))
                         host = host.parent;
                     if (host)


Mime
View raw message