You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/12/01 10:14:19 UTC

[1/5] git commit: [flex-asjs] [refs/heads/core_js_to_as] - fix panel background styling

Repository: flex-asjs
Updated Branches:
  refs/heads/core_js_to_as 443804dd3 -> eb92af671


fix panel background styling


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

Branch: refs/heads/core_js_to_as
Commit: 369541a0665f59c93ae5961576784d683688df5f
Parents: 443804d
Author: Alex Harui <ah...@apache.org>
Authored: Mon Nov 30 16:43:36 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Nov 30 16:43:36 2015 -0800

----------------------------------------------------------------------
 .../HTML/as/src/org/apache/flex/html/Panel.as        | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/369541a0/frameworks/projects/HTML/as/src/org/apache/flex/html/Panel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/Panel.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/Panel.as
index 6219d9d..e9c5986 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/Panel.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/Panel.as
@@ -20,6 +20,11 @@ package org.apache.flex.html
 {
 	import org.apache.flex.core.IPanelModel;
 
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;
+    }
+    
 	[Event(name="close", type="org.apache.flex.events.Event")]
 	
 	/**
@@ -103,6 +108,14 @@ package org.apache.flex.html
 		{
 			IPanelModel(model).showCloseButton = value;
 		}
-				
+		
+        COMPILE::JS
+        override protected function createElement():WrappedHTMLElement
+        {
+            super.createElement();
+            element.className = "Panel";
+            typeNames = "Panel";
+            return element;
+        }
 	}
 }


[3/5] git commit: [flex-asjs] [refs/heads/core_js_to_as] - Fix dropdownlist selection

Posted by ah...@apache.org.
Fix dropdownlist selection


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

Branch: refs/heads/core_js_to_as
Commit: 9cddf046562389c5a03c1c8e24fd781b63a07ccb
Parents: 7cec0a5
Author: Alex Harui <ah...@apache.org>
Authored: Mon Nov 30 16:55:17 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Nov 30 16:55:17 2015 -0800

----------------------------------------------------------------------
 .../HTML/as/src/org/apache/flex/html/DropDownList.as      | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cddf046/frameworks/projects/HTML/as/src/org/apache/flex/html/DropDownList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/DropDownList.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/DropDownList.as
index f4d5cbb..dd069b2 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/DropDownList.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/DropDownList.as
@@ -146,10 +146,15 @@ package org.apache.flex.html
 
         /**
          *  @private
+         *  @flexjsignorecoercion HTMLSelectElement
          */
         public function set selectedIndex(value:int):void
         {
             ISelectionModel(model).selectedIndex = value;
+            COMPILE::JS
+            {
+                (element as HTMLSelectElement).selectedIndex = ISelectionModel(model).selectedIndex;
+            }
         }
         
 
@@ -169,10 +174,15 @@ package org.apache.flex.html
 
         /**
          *  @private
+         *  @flexjsignorecoercion HTMLSelectElement
          */
         public function set selectedItem(value:Object):void
         {
             ISelectionModel(model).selectedItem = value;
+            COMPILE::JS
+            {
+                (element as HTMLSelectElement).selectedIndex = ISelectionModel(model).selectedIndex;
+            }
         }
                         
         /**


[4/5] git commit: [flex-asjs] [refs/heads/core_js_to_as] - fix textarea

Posted by ah...@apache.org.
fix textarea


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

Branch: refs/heads/core_js_to_as
Commit: 872e685698b4f179cc89401ff0c5234961e11db6
Parents: 9cddf04
Author: Alex Harui <ah...@apache.org>
Authored: Mon Nov 30 22:13:13 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Nov 30 22:13:13 2015 -0800

----------------------------------------------------------------------
 .../as/src/org/apache/flex/html/TextArea.as     | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/872e6856/frameworks/projects/HTML/as/src/org/apache/flex/html/TextArea.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/TextArea.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/TextArea.as
index 79ed2d5..57bc3c3 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/TextArea.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/TextArea.as
@@ -56,18 +56,34 @@ package org.apache.flex.html
          *  @playerversion Flash 10.2
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
+         *  @flexjsignorecoercion HTMLInputElement
          */
 		public function get text():String
 		{
-			return ITextModel(model).text;
+            COMPILE::AS3
+            {
+                return ITextModel(model).text;                    
+            }
+            COMPILE::JS
+            {
+                return (element as HTMLInputElement).value;
+            }
 		}
 
         /**
          *  @private
+         *  @flexjsignorecoercion HTMLInputElement
          */
 		public function set text(value:String):void
 		{
-			ITextModel(model).text = value;
+            COMPILE::AS3
+            {
+                ITextModel(model).text = value;                    
+            }
+            COMPILE::JS
+            {
+                (element as HTMLInputElement).value = value;
+            }
 		}
 		
         /**


[2/5] git commit: [flex-asjs] [refs/heads/core_js_to_as] - refactor addBead so we can set _view in all cases

Posted by ah...@apache.org.
refactor addBead so we can set _view in all cases


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

Branch: refs/heads/core_js_to_as
Commit: 7cec0a57da79653439b0c99eb2f058fbedaafaac
Parents: 369541a
Author: Alex Harui <ah...@apache.org>
Authored: Mon Nov 30 16:44:26 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Nov 30 16:44:26 2015 -0800

----------------------------------------------------------------------
 .../as/src/org/apache/flex/core/HTMLElementWrapper.as  | 13 +++++++++++--
 .../Core/as/src/org/apache/flex/core/UIBase.as         |  9 +--------
 2 files changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7cec0a57/frameworks/projects/Core/as/src/org/apache/flex/core/HTMLElementWrapper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/HTMLElementWrapper.as b/frameworks/projects/Core/as/src/org/apache/flex/core/HTMLElementWrapper.as
index a7779fb..bc8e224 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/HTMLElementWrapper.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/HTMLElementWrapper.as
@@ -19,7 +19,13 @@ package org.apache.flex.core
     COMPILE::AS3
     public class HTMLElementWrapper extends Sprite
     {
-        
+        /**
+         * "abstract" method so we can override in JS
+         * @param bead The new bead.
+         */
+        public function addBead(bead:IBead):void
+        {            
+        }
     }
     
 	COMPILE::JS
@@ -81,7 +87,10 @@ package org.apache.flex.core
             _element = value;
         }
         
-		private var _model:IBeadModel;
+        /**
+         * allow access from overrides
+         */
+		protected var _model:IBeadModel;
         
         /**
          * @flexjsignorecoercion Class 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7cec0a57/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
index 9a4cf16..0cd6a7c 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
@@ -1016,8 +1016,7 @@ package org.apache.flex.core
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */        
-        COMPILE::AS3
-		public function addBead(bead:IBead):void
+		override public function addBead(bead:IBead):void
 		{
 			if (!_beads)
 				_beads = new Vector.<IBead>;
@@ -1317,13 +1316,7 @@ package org.apache.flex.core
                 {
                     var view:IBeadView = new c as IBeadView;
                     if (view)
-                    {
-                        COMPILE::JS
-                        {
-                            _view = view;
-                        }
                         addBead(view);                        
-                    }
                 }
             }
             if (getBeadByType(IBeadController) == null) 


[5/5] git commit: [flex-asjs] [refs/heads/core_js_to_as] - fix rollovers and other mouseevents

Posted by ah...@apache.org.
fix rollovers and other mouseevents


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

Branch: refs/heads/core_js_to_as
Commit: eb92af6710fbe5782123335c9cb0a524176d1905
Parents: 872e685
Author: Alex Harui <ah...@apache.org>
Authored: Tue Dec 1 01:14:05 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Dec 1 01:14:05 2015 -0800

----------------------------------------------------------------------
 .../as/src/org/apache/flex/events/MouseEvent.as | 142 +++++++++++++++++--
 1 file changed, 134 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/eb92af67/frameworks/projects/Core/as/src/org/apache/flex/events/MouseEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/events/MouseEvent.as b/frameworks/projects/Core/as/src/org/apache/flex/events/MouseEvent.as
index a15971e..756438f 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/events/MouseEvent.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/events/MouseEvent.as
@@ -22,11 +22,16 @@ package org.apache.flex.events
     {
         import flash.events.MouseEvent;
     }
+    COMPILE::JS
+    {
+        import window.MouseEvent;
+    }
     
     import org.apache.flex.core.IUIBase;
     import org.apache.flex.geom.Point;
     import org.apache.flex.utils.PointUtils;
     
+    
 	/**
 	 *  Mouse events
      *  
@@ -37,15 +42,27 @@ package org.apache.flex.events
 	 */
 	public class MouseEvent extends Event
 	{
-		public static const MOUSE_DOWN:String = "mouseDown";
-        public static const MOUSE_MOVE:String = "mouseMove";
-		public static const MOUSE_UP:String = "mouseUp";
-		public static const MOUSE_OUT:String = "mouseOut";
-		public static const MOUSE_OVER:String = "mouseOver";
-		public static const ROLL_OVER:String = "rollOver";
-		public static const ROLL_OUT:String = "rollOut";
+        private static function platformConstant(s:String):String
+        {
+            COMPILE::AS3
+            {
+                return s;
+            }
+            COMPILE::JS
+            {
+                return s.toLowerCase();
+            }
+        }
+        
+		public static const MOUSE_DOWN:String = platformConstant("mouseDown");
+        public static const MOUSE_MOVE:String = platformConstant("mouseMove");
+		public static const MOUSE_UP:String = platformConstant("mouseUp");
+		public static const MOUSE_OUT:String = platformConstant("mouseOut");
+		public static const MOUSE_OVER:String = platformConstant("mouseOver");
+		public static const ROLL_OVER:String = platformConstant("rollOver");
+		public static const ROLL_OUT:String = platformConstant("rollOut");
         public static const CLICK:String = "click";
-
+        
          /**
          *  Constructor.
          *  
@@ -160,5 +177,114 @@ package org.apache.flex.events
             }
             return _stagePoint.y;            
         }
+        
+        /**
+         * @private
+         */
+        COMPILE::JS
+        private static function installRollOverMixin():Boolean
+        {
+            window.addEventListener(MOUSE_OVER,
+                mouseOverHandler, false);
+            return true;
+        }
+        
+        
+        /**
+         * @param e The event.
+         * RollOver/RollOut is entirely implemented in mouseOver because
+         * when a parent and child share an edge, you only get a mouseout
+         * for the child and not the parent and you need to send rollout
+         * to both.  A similar issue exists for rollover.
+         */
+        COMPILE::JS
+        private static function mouseOverHandler(e:MouseEvent):void
+        {
+            var j:int;
+            var m:int;
+            var outs:Array;
+            var me:window.MouseEvent;
+            var parent:Object;
+            var target:Object = e.target.flexjs_wrapper;
+            if (target == null)
+                return; // probably over the html tag
+            var targets:Array = MouseEvent.targets;
+            var index:int = targets.indexOf(target);
+            if (index != -1) {
+                // get all children
+                outs = targets.slice(index + 1);
+                m = outs.length;
+                for (j = 0; j < m; j++) {
+                    me = makeMouseEvent(
+                        ROLL_OUT, e);
+                    outs[j].element.dispatchEvent(me);
+                }
+                MouseEvent.targets = targets.slice(0, index + 1);
+            }
+            else {
+                var newTargets:Array = [target];
+                if (!('parent' in target))
+                    parent = null;
+                else
+                    parent = target.parent;
+                while (parent) {
+                    index = targets.indexOf(parent);
+                    if (index == -1) {
+                        newTargets.unshift(parent);
+                        if (!('parent' in parent))
+                            break;
+                        parent = parent.parent;
+                    }
+                    else {
+                        outs = targets.slice(index + 1);
+                        m = outs.length;
+                        for (j = 0; j < m; j++) {
+                            me = makeMouseEvent(
+                                ROLL_OUT, e);
+                            outs[j].element.dispatchEvent(me);
+                        }
+                        targets = targets.slice(0, index + 1);
+                        break;
+                    }
+                }
+                var n:int = newTargets.length;
+                for (var i:int = 0; i < n; i++) {
+                    me = makeMouseEvent(
+                        ROLL_OVER, e);
+                    newTargets[i].element.dispatchEvent(me);
+                }
+                MouseEvent.targets = targets.concat(newTargets);
+            }
+        }
+        
+        
+        /**
+         */
+        COMPILE::JS
+        private static var rollOverMixin:Boolean =
+            installRollOverMixin();
+        
+        
+        /**
+         */
+        COMPILE::JS
+        private static var targets:Array = [];
+
+        /**
+         * @param {string} type The event type.
+         * @param {Event} e The mouse event.
+         * @return {MouseEvent} The new event.
+         */
+        COMPILE::JS
+        private static function makeMouseEvent(type:String, e:window.MouseEvent):window.MouseEvent
+        {
+            var out:window.MouseEvent = new window.MouseEvent(type);
+            out.initMouseEvent(type, false, false,
+                e.view, e.detail, e.screenX, e.screenY,
+                e.clientX, e.clientY, e.ctrlKey, e.altKey,
+                e.shiftKey, e.metaKey, e.button, e.relatedTarget);
+            return out;
+        };
+
 	}
 }