You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/08/05 01:18:25 UTC

[royale-asjs] branch feature/MXRoyale updated (392d8c6 -> 6ebab10)

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a change to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git.


    from 392d8c6  forgot import
     new 4d48183  SWF views should use  to attach to strand so regular addChild can be overridden (by emulation components, for example)
     new d70affe  get parameters property working
     new ae10d68  refactor to have UIComponent override addChild so addedToParent gets called
     new 5058724  first swf implementation of styles
     new bac3d84  also implement fontWeight
     new 9cdad94  fix percentages
     new e54eca7  try being smarter about when to run layouts.  If not sized to content or explicitly sized, some other code should end up setting your size which should result in a layout pass
     new be59494  force layout on SWF side
     new 6ebab10  use  to get tests to pass

The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../royale/html/accessories/TextPromptBead.as      |   4 +-
 .../royale/html/beads/BackgroundImageBead.as       |   2 +-
 .../org/apache/royale/html/beads/HScrollBarView.as |   8 +-
 .../org/apache/royale/html/beads/PanelView.as      |  13 ++-
 .../org/apache/royale/html/beads/SpinnerView.as    |   4 +-
 .../apache/royale/html/beads/TextFieldViewBase.as  |   4 +-
 .../org/apache/royale/html/beads/VScrollBarView.as |   8 +-
 .../org/apache/royale/html/beads/WebBrowserView.as |   2 +-
 .../royale/org/apache/royale/core/ImageViewBase.as |  10 +-
 .../MXRoyale/src/main/royale/mx/containers/Box.as  |   5 +-
 .../MXRoyale/src/main/royale/mx/containers/Form.as |  57 +----------
 .../src/main/royale/mx/containers/GridRow.as       |   2 +-
 .../src/main/royale/mx/containers/Panel.as         |   8 +-
 .../src/main/royale/mx/containers/ViewStack.as     |  26 ++---
 .../src/main/royale/mx/controls/MenuBar.as         |   9 +-
 .../src/main/royale/mx/core/Application.as         |  43 ++++++++
 .../MXRoyale/src/main/royale/mx/core/Container.as  |  11 +-
 .../error/SortError.as => core/FlexCSSStyles.as}   |  50 +++++----
 .../MXRoyale/src/main/royale/mx/core/IChildList.as |  36 ++-----
 .../src/main/royale/mx/core/UIComponent.as         |  95 +++++++++--------
 .../src/main/royale/mx/managers/SystemManager.as   | 112 +++++++++++++++------
 mustella/src/main/royale/UnitTester.as             |   6 +-
 22 files changed, 287 insertions(+), 228 deletions(-)
 copy frameworks/projects/MXRoyale/src/main/royale/mx/{collections/error/SortError.as => core/FlexCSSStyles.as} (64%)


[royale-asjs] 04/09: first swf implementation of styles

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 50587248ea159d05a08c8487a5014c196dbb1239
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Aug 4 11:32:20 2018 -0700

    first swf implementation of styles
---
 .../src/main/royale/mx/core/FlexCSSStyles.as       | 66 ++++++++++++++++++++++
 .../src/main/royale/mx/core/UIComponent.as         | 17 +++---
 2 files changed, 76 insertions(+), 7 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/FlexCSSStyles.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/FlexCSSStyles.as
new file mode 100644
index 0000000..3f8a081
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/FlexCSSStyles.as
@@ -0,0 +1,66 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.core
+{
+/*
+import flash.display.DisplayObject;
+import flash.display.Graphics;
+import flash.display.Shape;
+import flash.events.Event;
+import flash.events.MouseEvent;
+import flash.geom.Point;
+
+import mx.controls.HScrollBar;
+import mx.controls.VScrollBar;
+import mx.controls.scrollClasses.ScrollBar;
+import mx.core.IToolTip;
+*/
+import org.apache.royale.core.AllCSSStyles;
+/*
+import mx.events.ScrollEventDetail;
+import mx.events.ScrollEventDirection;
+import mx.managers.ToolTipManager;
+import mx.styles.ISimpleStyleClient;
+
+*/
+
+/**
+ *  The Flex styles holder.
+
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class FlexCSSStyles extends AllCSSStyles
+{
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    // add slots for Flex specific styles.
+    public var horizontalGap:*;
+    public var verticalGap:*;
+
+}
+}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index e09e866..f8567e1 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -4125,14 +4125,11 @@ public class UIComponent extends UIBase
      */
     public function get fontSize():Object
     {
-        if (GOOG::DEBUG)
-            trace("fontSize not implemented");
-        return 0;
+        return ValuesManager.valuesImpl.getValue(this, "fontSize");
     }
     public function set fontSize(value:Object):void
     {
-        if (GOOG::DEBUG)
-            trace("fontSize not implemented");
+        setStyle("fontSize", value);
     }
 	[Inspectable(category="General")]
 	
@@ -4370,8 +4367,14 @@ public class UIComponent extends UIBase
      */
     public function setStyle(styleProp:String, newValue:*):void
     {
-        if (GOOG::DEBUG)
-            trace("setStyle not implemented");
+        if (!style)
+            style = new FlexCSSStyles();
+        style[styleProp] = newValue;
+        COMPILE::JS
+        {
+        if (initialized)
+            ValuesManager.valuesImpl.applyStyles(this, style);
+        }
     }
 
 


[royale-asjs] 06/09: fix percentages

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 9cdad94a780bebe35156beec6a9f60e5928fede3
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Aug 4 13:09:46 2018 -0700

    fix percentages
---
 .../src/main/royale/mx/core/UIComponent.as         | 34 ++++------------------
 1 file changed, 5 insertions(+), 29 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index 6f58774..2fd6210 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -1846,12 +1846,6 @@ public class UIComponent extends UIBase
     //  percentWidth
     //----------------------------------
 
-    /**
-     *  @private
-     *  Storage for the percentWidth property.
-     */
-    private var _percentWidth:Number;
-
     [Bindable("resize")]
     [Inspectable(environment="none")]
 
@@ -1879,7 +1873,7 @@ public class UIComponent extends UIBase
      */
     override public function get percentWidth():Number
     {
-        return _percentWidth;
+        return super.percentWidth;
     }
 
     /**
@@ -1887,14 +1881,8 @@ public class UIComponent extends UIBase
      */
     override public function set percentWidth(value:Number):void
     {
-        if (_percentWidth == value)
-            return;
-
-        if (!isNaN(value))
-            _explicitWidth = NaN;
-
-        _percentWidth = value;
-
+        super.percentWidth = value;
+        
          invalidateParentSizeAndDisplayList();
     }
 
@@ -1902,12 +1890,6 @@ public class UIComponent extends UIBase
     //  percentHeight
     //----------------------------------
 
-    /**
-     *  @private
-     *  Storage for the percentHeight property.
-     */
-    private var _percentHeight:Number;
-
     [Bindable("resize")]
     [Inspectable(environment="none")]
 
@@ -1935,7 +1917,7 @@ public class UIComponent extends UIBase
      */
     override public function get percentHeight():Number
     {
-        return _percentHeight;
+        return super.percentHeight;
     }
 
     /**
@@ -1943,13 +1925,7 @@ public class UIComponent extends UIBase
      */
     override public function set percentHeight(value:Number):void
     {
-        if (_percentHeight == value)
-            return;
-
-        if (!isNaN(value))
-            _explicitHeight = NaN;
-
-        _percentHeight = value;
+        super.percentHeight = value;
 
         invalidateParentSizeAndDisplayList();
     }


[royale-asjs] 01/09: SWF views should use to attach to strand so regular addChild can be overridden (by emulation components, for example)

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 4d48183b44023340ed29ebcc236ec3d08fea7539
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Aug 4 11:02:27 2018 -0700

    SWF views should use  to attach to strand so regular addChild can be overridden (by emulation components, for example)
---
 .../org/apache/royale/html/accessories/TextPromptBead.as       |  4 ++--
 .../royale/org/apache/royale/html/beads/BackgroundImageBead.as |  2 +-
 .../main/royale/org/apache/royale/html/beads/HScrollBarView.as |  8 ++++----
 .../main/royale/org/apache/royale/html/beads/SpinnerView.as    |  4 ++--
 .../royale/org/apache/royale/html/beads/TextFieldViewBase.as   |  4 +---
 .../main/royale/org/apache/royale/html/beads/VScrollBarView.as |  8 ++++----
 .../main/royale/org/apache/royale/html/beads/WebBrowserView.as |  2 +-
 .../src/main/royale/org/apache/royale/core/ImageViewBase.as    | 10 ++++++++--
 8 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/TextPromptBead.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/TextPromptBead.as
index c75d84f..a36bc3b 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/TextPromptBead.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/TextPromptBead.as
@@ -135,11 +135,11 @@ package org.apache.royale.html.accessories
 			var model:Object = UIBase(_strand).model;
 			
 			if (model.text != null && model.text.length > 0 ) {
-				if (promptAdded) UIBase(_strand).removeChild(promptField);
+				if (promptAdded) UIBase(_strand).$removeChild(promptField);
 				promptAdded = false;
 			}
 			else {
-				if (!promptAdded) UIBase(_strand).addChild(promptField);
+				if (!promptAdded) UIBase(_strand).$addChild(promptField);
 				promptField.text = prompt;
 				promptAdded = true;
                 promptField.x = 2;
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/BackgroundImageBead.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/BackgroundImageBead.as
index f553af2..ea9d827 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/BackgroundImageBead.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/BackgroundImageBead.as
@@ -94,7 +94,7 @@ package org.apache.royale.html.beads
 					
 					bitmap = Bitmap(LoaderInfo(e.target).content);
 					
-					host.addChildAt(bitmap,0);
+					host.$addChildAt(bitmap,0);
 					
 					if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
 						host.setWidth(loader.content.width);
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/HScrollBarView.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/HScrollBarView.as
index 1e6d8f2..77cd622 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/HScrollBarView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/HScrollBarView.as
@@ -86,10 +86,10 @@ package org.apache.royale.html.beads
 			_thumb = new Button();				
 			Button(_thumb).addBead(new HScrollBarThumbView());
             
-            UIBase(value).addChild(_decrement);
-            UIBase(value).addChild(_increment);
-            UIBase(value).addChild(_track);
-            UIBase(value).addChild(_thumb);
+            UIBase(value).$addChild(_decrement);
+            UIBase(value).$addChild(_increment);
+            UIBase(value).$addChild(_track);
+            UIBase(value).$addChild(_thumb);
             
             IEventDispatcher(_strand).addEventListener("widthChanged", changeHandler);
 
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SpinnerView.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SpinnerView.as
index 3f5cffc..52085c5 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SpinnerView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SpinnerView.as
@@ -102,8 +102,8 @@ COMPILE::JS {
 				Button(_decrement).x = 0;
 				Button(_decrement).y = Button(_increment).height;
 
-				UIBase(_strand).addChild(_decrement);
-				UIBase(_strand).addChild(_increment);
+				UIBase(_strand).$addChild(_decrement);
+				UIBase(_strand).$addChild(_increment);
 				rangeModel = _strand.getBeadByType(IBeadModel) as IRangeModel;
 			}
 			IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextFieldViewBase.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextFieldViewBase.as
index bfbe960..4db911b 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextFieldViewBase.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextFieldViewBase.as
@@ -18,8 +18,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.html.beads
 {
-	import flash.display.DisplayObject;
-	import flash.display.DisplayObjectContainer;
 	import flash.text.StyleSheet;
 	
 	import org.apache.royale.core.CSSTextField;
@@ -95,7 +93,7 @@ package org.apache.royale.html.beads
             IEventDispatcher(_strand).addEventListener("widthChanged", widthChangeHandler);
             IEventDispatcher(_strand).addEventListener("heightChanged", heightChangeHandler);
             IEventDispatcher(_strand).addEventListener("sizeChanged", sizeChangeHandler);
-			DisplayObjectContainer(value).addChild(_textField);
+			UIBase(value).$addChild(_textField);
 
             var ilc:ILayoutChild = host as ILayoutChild;
             autoHeight = ilc.isHeightSizedToContent();
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VScrollBarView.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VScrollBarView.as
index 9fb1047..8aa9b8e 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VScrollBarView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VScrollBarView.as
@@ -106,10 +106,10 @@ package org.apache.royale.html.beads
 			_thumb = new Button();				
 			Button(_thumb).addBead(new VScrollBarThumbView());
             
-            UIBase(value).addChild(_decrement);
-            UIBase(value).addChild(_increment);
-            UIBase(value).addChild(_track);
-            UIBase(value).addChild(_thumb);
+            UIBase(value).$addChild(_decrement);
+            UIBase(value).$addChild(_increment);
+            UIBase(value).$addChild(_track);
+            UIBase(value).$addChild(_thumb);
             
             IEventDispatcher(_strand).addEventListener("heightChanged", changeHandler);
             
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/WebBrowserView.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/WebBrowserView.as
index 37762fb..e84ec78 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/WebBrowserView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/WebBrowserView.as
@@ -94,7 +94,7 @@ package org.apache.royale.html.beads
 			loader.y = 0;
 			loader.width = host.width;
 			loader.height = host.height;
-			(host as UIBase).addChild(loader);
+			(host as UIBase).$addChild(loader);
 		}
 
 		/**
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
index 49ab77f..d7fb687 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
@@ -174,12 +174,18 @@ package org.apache.royale.core
 			var hostSprite:Sprite = (host as IRenderedObject).$displayObject as Sprite;
 			
 			if (bitmap) {
-				hostSprite.removeChild(bitmap);
+                if ("$removeChild" in hostSprite)
+                    hostSprite["$removeChild"](bitmap);
+                else
+    				hostSprite.removeChild(bitmap);
 			}
 			
 			bitmap = Bitmap(LoaderInfo(event.target).content);
 			
-			hostSprite.addChild(bitmap);
+            if ("$addChild" in hostSprite)
+                hostSprite["$addChild"](bitmap);
+            else
+    			hostSprite.addChild(bitmap);
 			
             if (host.isWidthSizedToContent())
             {


[royale-asjs] 03/09: refactor to have UIComponent override addChild so addedToParent gets called

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit ae10d6865ce585e6107e9b5096be7d93179bdea8
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Aug 4 11:04:27 2018 -0700

    refactor to have UIComponent override addChild so addedToParent gets called
---
 .../MXRoyale/src/main/royale/mx/containers/Form.as |  57 +----------
 .../src/main/royale/mx/containers/GridRow.as       |   2 +-
 .../src/main/royale/mx/containers/ViewStack.as     |  26 ++---
 .../MXRoyale/src/main/royale/mx/core/Container.as  |   5 +-
 .../MXRoyale/src/main/royale/mx/core/IChildList.as |  36 ++-----
 .../src/main/royale/mx/core/UIComponent.as         |  36 +++++--
 .../src/main/royale/mx/managers/SystemManager.as   | 114 ++++++++++++++-------
 7 files changed, 134 insertions(+), 142 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Form.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Form.as
index 4275e44..23a9ab0 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Form.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Form.as
@@ -290,65 +290,16 @@ public class Form extends Container
      *  Discard the cached measuredLabelWidth if a child
      *  is added or removed.
      */
-    COMPILE::SWF
-    override public function addChild(child:DisplayObject):DisplayObject
-    {
-        invalidateLabelWidth();
-        
-        return super.addChild(child);
-    }
-
-    /**
-     *  @private
-     */
-    COMPILE::SWF
-    override public function addChildAt(child:DisplayObject,
-                                        index:int):DisplayObject
-    {
-        invalidateLabelWidth();
-        
-        return super.addChildAt(child, index);
-    }
-
-    /**
-     *  @private
-     */
-    COMPILE::SWF
-    override public function removeChild(child:DisplayObject):DisplayObject
-    {
-        invalidateLabelWidth();
-        
-        return super.removeChild(child);
-    }
-
-    /**
-     *  @private
-     */
-    COMPILE::SWF
-    override public function removeChildAt(index:int):DisplayObject
-    {
-        invalidateLabelWidth();
-        
-        return super.removeChildAt(index);
-    }
-
-    /**
-     *  @private
-     *  Discard the cached measuredLabelWidth if a child
-     *  is added or removed.
-     */
-    COMPILE::JS
     override public function addChild(child:IUIComponent):IUIComponent
     {
         invalidateLabelWidth();
         
         return super.addChild(child);
     }
-    
+
     /**
      *  @private
      */
-    COMPILE::JS
     override public function addChildAt(child:IUIComponent,
                                         index:int):IUIComponent
     {
@@ -356,22 +307,20 @@ public class Form extends Container
         
         return super.addChildAt(child, index);
     }
-    
+
     /**
      *  @private
      */
-    COMPILE::JS
     override public function removeChild(child:IUIComponent):IUIComponent
     {
         invalidateLabelWidth();
         
         return super.removeChild(child);
     }
-    
+
     /**
      *  @private
      */
-    COMPILE::JS
     override public function removeChildAt(index:int):IUIComponent
     {
         invalidateLabelWidth();
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/GridRow.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/GridRow.as
index 96e2354..909800f 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/GridRow.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/GridRow.as
@@ -319,7 +319,7 @@ public class GridRow extends HBox
      *  the column size and arrange children in proper order.
      *  Hence invalidate the size and layout of the Grid.
      */
-    override public function setChildIndex(child:ROYALE::DISPLAYOBJECT,
+    override public function setChildIndex(child:IUIComponent,
                                            newIndex:int):void
     {
         super.setChildIndex(child, newIndex);
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
index b0dd4ff..934184b 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
@@ -647,7 +647,7 @@ public class ViewStack extends Container // implements IHistoryManagerClient, IS
     public function set selectedChild(
                             value:INavigatorContent):void
     {
-        var newIndex:int = getChildIndex(ROYALE::DISPLAYOBJECT(value));
+        var newIndex:int = getChildIndex(IUIComponent(value));
 
         if (newIndex >= 0 && newIndex < numChildren)
             selectedIndex = newIndex;
@@ -1333,7 +1333,7 @@ public class ViewStack extends Container // implements IHistoryManagerClient, IS
     /**
      *  @private
      */
-    private function childAddHandler(child:ROYALE::DISPLAYOBJECT):void
+    private function childAddHandler(child:IUIComponent):void
     {
         var index:int = getChildIndex(child);
 
@@ -1379,7 +1379,7 @@ public class ViewStack extends Container // implements IHistoryManagerClient, IS
      *  next (or previous) child gets automatically selected; when the last
      *  remaining child is removed, the selectedIndex is set to -1.
      */
-    private function childRemoveHandler(child:ROYALE::DISPLAYOBJECT, index:int):void
+    private function childRemoveHandler(child:IUIComponent, index:int):void
     {
         if (child is INavigatorContent)
         {
@@ -1430,10 +1430,10 @@ public class ViewStack extends Container // implements IHistoryManagerClient, IS
     /**
      *  @private
      */
-    override public function addChildAt(item:ROYALE::DISPLAYOBJECT, index:int):ROYALE::DISPLAYOBJECT
+    override public function addChildAt(item:IUIComponent, index:int):IUIComponent
     {
         addingChildren = true;
-        var obj:ROYALE::DISPLAYOBJECT = super.addChildAt(item, index);
+        var obj:IUIComponent = super.addChildAt(item, index);
         internalDispatchEvent(CollectionEventKind.ADD, obj, index);
         childAddHandler(item);
         addingChildren = false;
@@ -1443,10 +1443,10 @@ public class ViewStack extends Container // implements IHistoryManagerClient, IS
     /**
      *  @private
      */
-    override public function removeChild(item:ROYALE::DISPLAYOBJECT):ROYALE::DISPLAYOBJECT
+    override public function removeChild(item:IUIComponent):IUIComponent
     {
         var index:int = getChildIndex(item);
-        var obj:ROYALE::DISPLAYOBJECT = super.removeChild(item);
+        var obj:IUIComponent = super.removeChild(item);
         internalDispatchEvent(CollectionEventKind.REMOVE, obj, index);
         childRemoveHandler(item, index);
         return obj;
@@ -1479,7 +1479,7 @@ public class ViewStack extends Container // implements IHistoryManagerClient, IS
         pe.source = event.target;
         pe.property = (event.type == "labelChanged") ? "label" : "icon";
 
-        internalDispatchEvent(CollectionEventKind.UPDATE, pe, getChildIndex(event.target as ROYALE::DISPLAYOBJECT));
+        internalDispatchEvent(CollectionEventKind.UPDATE, pe, getChildIndex(event.target as IUIComponent));
     }
 
     /**
@@ -1536,7 +1536,7 @@ public class ViewStack extends Container // implements IHistoryManagerClient, IS
      */
     public function addItem(item:Object):void
     {
-        addChild(item as ROYALE::DISPLAYOBJECT);
+        addChild(item as IUIComponent);
     }
 
     /**
@@ -1545,7 +1545,7 @@ public class ViewStack extends Container // implements IHistoryManagerClient, IS
      */
     public function addItemAt(item:Object, index:int):void
     {
-        addChildAt(item as ROYALE::DISPLAYOBJECT, index);
+        addChildAt(item as IUIComponent, index);
     }
 
     /**
@@ -1564,7 +1564,7 @@ public class ViewStack extends Container // implements IHistoryManagerClient, IS
     public function getItemIndex(item:Object):int
     {
 		if (isValidChild(item as ROYALE::DISPLAYOBJECT))
-        	return getChildIndex(item as ROYALE::DISPLAYOBJECT);
+        	return getChildIndex(item as IUIComponent);
 		else
 			return -1;
     }
@@ -1605,7 +1605,7 @@ public class ViewStack extends Container // implements IHistoryManagerClient, IS
 	 */
 	public function removeItem(item:Object):Boolean
 	{
-		var displayObject:ROYALE::DISPLAYOBJECT = removeChild(item as ROYALE::DISPLAYOBJECT);
+		var displayObject:IUIComponent = removeChild(item as IUIComponent);
 		return displayObject != null;
 	}
 
@@ -1626,7 +1626,7 @@ public class ViewStack extends Container // implements IHistoryManagerClient, IS
     public function setItemAt(item:Object, index:int):Object
     {
         var result:Object = removeChildAt(index);
-        addChildAt(item as ROYALE::DISPLAYOBJECT,index);
+        addChildAt(item as IUIComponent,index);
         return result;
     }
 
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
index baf8adb..eae74d8 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
@@ -996,12 +996,13 @@ public class Container extends UIComponent
 		return contentView.getElementAt(index);
 	}
 	
+    [SWFOverride(returns="flash.display.DisplayObject"))]
     COMPILE::SWF
-    override public function getChildAt(index:int):DisplayObject
+    override public function getChildAt(index:int):IUIComponent
     {
         var layoutHost:ILayoutHost = view as ILayoutHost;
         var contentView:IParent = layoutHost.contentView as IParent;
-        return contentView.getElementAt(index) as DisplayObject;
+        return contentView.getElementAt(index) as IUIComponent;
     }
 
 	/*
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IChildList.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IChildList.as
index 1f12495..876d2d4 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IChildList.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IChildList.as
@@ -112,10 +112,8 @@ public interface IChildList
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent", returns="flash.display.DisplayObject"))]
 	function addChild(child:IUIComponent):IUIComponent;
-    COMPILE::SWF
-    function addChild(child:DisplayObject):DisplayObject;
 	
     /**
      *  Adds a child DisplayObject to this child list at the index specified.
@@ -138,10 +136,8 @@ public interface IChildList
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject,int", altparams="mx.core.UIComponent,int", returns="flash.display.DisplayObject"))]
 	function addChildAt(child:IUIComponent, index:int):IUIComponent;
-    COMPILE::SWF
-    function addChildAt(child:DisplayObject, index:int):DisplayObject;
 	
     /**
      *  Removes the specified child DisplayObject from this child list.
@@ -162,10 +158,8 @@ public interface IChildList
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent", returns="flash.display.DisplayObject"))]
 	function removeChild(child:IUIComponent):IUIComponent;
-    COMPILE::SWF
-    function removeChild(child:DisplayObject):DisplayObject;
 	
     /**
      *  Removes the child DisplayObject at the specified index
@@ -186,10 +180,8 @@ public interface IChildList
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */	     
-    COMPILE::JS
+    [SWFOverride(returns="flash.display.DisplayObject"))]
 	function removeChildAt(index:int):IUIComponent;
-    COMPILE::SWF
-    function removeChildAt(index:int):DisplayObject;
 	
 	/**
 	 *  Gets the child DisplayObject at the specified index in this child list.
@@ -204,10 +196,8 @@ public interface IChildList
 	 *  @playerversion AIR 1.1
 	 *  @productversion Flex 3
 	 */
-    COMPILE::JS
+    [SWFOverride(returns="flash.display.DisplayObject"))]
   	function getChildAt(index:int):IUIComponent;
-    COMPILE::SWF
-    function getChildAt(index:int):DisplayObject;
 	
     /**
      *  Gets the child DisplayObject with the specified name
@@ -222,10 +212,8 @@ public interface IChildList
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
-    COMPILE::JS
+    [SWFOverride(returns="flash.display.DisplayObject"))]
   	function getChildByName(name:String):IUIComponent;
-    COMPILE::SWF
-    function getChildByName(name:String):DisplayObject;
   	
 	/**
 	 *  Gets the index of a specific child in this child list.
@@ -269,10 +257,8 @@ public interface IChildList
 	 *  @playerversion AIR 1.1
 	 *  @productversion Flex 3
 	 */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent"))]
   	function getChildIndex(child:IUIComponent):int;
-    COMPILE::SWF
-    function getChildIndex(child:DisplayObject):int;
   	
 	/**
 	 *  Changes the index of a particular child in this child list.
@@ -289,10 +275,8 @@ public interface IChildList
 	 *  @playerversion AIR 1.1
 	 *  @productversion Flex 3
 	 */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject,int", altparams="mx.core.UIComponent,int"))]
 	function setChildIndex(child:IUIComponent, newIndex:int):void;
-    COMPILE::SWF
-    function setChildIndex(child:DisplayObject, newIndex:int):void;
 	
 	/**
 	 *  Determines if a DisplayObject is in this child list,
@@ -309,10 +293,8 @@ public interface IChildList
 	 *  @playerversion AIR 1.1
 	 *  @productversion Flex 3
 	 */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent"))]
 	function contains(child:IUIComponent):Boolean;
-    COMPILE::SWF
-    function contains(child:DisplayObject):Boolean;
 }
 
 }
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index 238e98d..e09e866 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -2967,7 +2967,9 @@ public class UIComponent extends UIBase
      *  @private
      *  @royaleignorecoercion mx.core.IUIComponent
      */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent", returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
     public function addChild(child:IUIComponent):IUIComponent
     {
         return addElement(child) as IUIComponent;
@@ -2977,7 +2979,9 @@ public class UIComponent extends UIBase
      *  @private
      *  @royaleignorecoercion mx.core.IUIComponent
      */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject,int", altparams="mx.core.UIComponent,int", returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
     public function addChildAt(child:IUIComponent,
                                         index:int):IUIComponent
     {
@@ -2988,7 +2992,9 @@ public class UIComponent extends UIBase
      *  @private
      *  @royaleignorecoercion mx.core.IUIComponent
      */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent", returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
     public function removeChild(child:IUIComponent):IUIComponent
     {
         return removeElement(child) as IUIComponent;
@@ -3003,7 +3009,9 @@ public class UIComponent extends UIBase
      *  @private
      *  @royaleignorecoercion mx.core.IUIComponent
      */
-    COMPILE::JS
+    [SWFOverride(returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
     public function removeChildAt(index:int):IUIComponent
     {
         if (GOOG::DEBUG)
@@ -3016,7 +3024,9 @@ public class UIComponent extends UIBase
      *  @private
      *  @royaleignorecoercion mx.core.IUIComponent
      */
-    COMPILE::JS
+    [SWFOverride(returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
     public function getChildAt(index:int):IUIComponent
     {
         return getElementAt(index) as IUIComponent;
@@ -3035,7 +3045,9 @@ public class UIComponent extends UIBase
     /**
      *  @private
      */
-    COMPILE::JS 
+    [SWFOverride(params="flash.display.DisplayObject,int", altparams="mx.core.UIComponent,int"))]
+    COMPILE::SWF 
+    { override }
     public function setChildIndex(child:IUIComponent, index:int):void
     {
         if (GOOG::DEBUG)
@@ -3045,7 +3057,9 @@ public class UIComponent extends UIBase
     /**
      *  @private
      */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent"))]
+    COMPILE::SWF 
+    { override }
     public function getChildIndex(child:IUIComponent):int
     {
         return getElementIndex(child);
@@ -3054,7 +3068,9 @@ public class UIComponent extends UIBase
     /**
      *  @private
      */
-    COMPILE::JS
+    [SWFOverride(returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
     public function getChildByName(name:String):IUIComponent
     {
         if (GOOG::DEBUG)
@@ -3065,7 +3081,9 @@ public class UIComponent extends UIBase
     /**
      *  @private
      */
-    COMPILE::JS 
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent"))]
+    COMPILE::SWF 
+    { override }
     public function contains(child:IUIComponent):Boolean
     {
         if (GOOG::DEBUG)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as
index 77c4ee5..7deb47c 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as
@@ -94,6 +94,7 @@ use namespace mx_internal;
 import mx.core.IChildList;
 import mx.core.IFlexDisplayObject;
 import mx.core.IUIComponent;
+
 import org.apache.royale.core.IUIBase;
 import org.apache.royale.events.IEventDispatcher;
 
@@ -1535,8 +1536,10 @@ public class SystemManager extends SystemManagerBase implements ISystemManager,
     /**
      *  @private
      */
-    COMPILE::SWF
-    override public function addChild(child:DisplayObject):DisplayObject
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent", returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
+    public function addChild(child:IUIComponent):IUIComponent
     {
         /*
         var addIndex:int = numChildren;
@@ -1545,10 +1548,17 @@ public class SystemManager extends SystemManagerBase implements ISystemManager,
 
         return addChildAt(child, addIndex);
         */
-        var ret:DisplayObject = super.addChild(child);
-        if (ret is IUIBase)
-            (ret as IUIBase).addedToParent();
-        return ret;
+        COMPILE::JS
+        {
+            return addElement(child) as IUIComponent;
+        }
+        COMPILE::SWF
+        {
+            var ret:DisplayObject = super.addChild(child as DisplayObject);
+            if (ret is IUIBase)
+                (ret as IUIBase).addedToParent();
+            return ret as IUIComponent;
+        }
     }
 
     /**
@@ -1709,31 +1719,43 @@ public class SystemManager extends SystemManagerBase implements ISystemManager,
      *  @private
      *  @royaleignorecoercion mx.core.IUIComponent
      */
-    COMPILE::JS
-    public function addChild(child:IUIComponent):IUIComponent
-    {
-        return addElement(child) as IUIComponent;
-    }
-    
-    /**
-     *  @private
-     *  @royaleignorecoercion mx.core.IUIComponent
-     */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject,int", altparams="mx.core.UIComponent,int", returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
     public function addChildAt(child:IUIComponent,
                                index:int):IUIComponent
     {
-        return addElementAt(child, index) as IUIComponent;
+        COMPILE::JS
+        {
+            return addElementAt(child, index) as IUIComponent;
+        }
+        COMPILE::SWF
+        {
+            var ret:DisplayObject = super.addChildAt(child as DisplayObject);
+            if (ret is IUIBase)
+                (ret as IUIBase).addedToParent();
+            return ret as IUIComponent;
+        }
     }
     
     /**
      *  @private
      *  @royaleignorecoercion mx.core.IUIComponent
      */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent", returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
     public function removeChild(child:IUIComponent):IUIComponent
     {
-        return removeElement(child) as IUIComponent;
+        COMPILE::JS
+        {
+            return removeElement(child) as IUIComponent;
+        }
+        COMPILE::SWF
+        {
+            var ret:DisplayObject = super.removeChild(child as DisplayObject);
+            return ret as IUIComponent;
+        }
     }
     
     
@@ -1741,7 +1763,9 @@ public class SystemManager extends SystemManagerBase implements ISystemManager,
      *  @private
      *  @royaleignorecoercion mx.core.IUIComponent
      */
-    COMPILE::JS
+    [SWFOverride(returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
     public function removeChildAt(index:int):IUIComponent
     {
         if (GOOG::DEBUG)
@@ -1754,10 +1778,20 @@ public class SystemManager extends SystemManagerBase implements ISystemManager,
      *  @private
      *  @royaleignorecoercion mx.core.IUIComponent
      */
-    COMPILE::JS
+    [SWFOverride(returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
     public function getChildAt(index:int):IUIComponent
     {
-        return getElementAt(index) as IUIComponent;
+        COMPILE::JS
+        {
+            return getElementAt(index) as IUIComponent;
+        }
+        COMPILE::SWF
+        {
+            var ret:DisplayObject = super.getChildAt(index);
+            return ret as IUIComponent;
+        }
     }
             
     //--------------------------------------------------------------------------
@@ -2868,14 +2902,7 @@ public class SystemManager extends SystemManagerBase implements ISystemManager,
         component = IUIComponent(create());
         // until preloader?
         component.addEventListener("applicationComplete", applicationCompleteHandler);
-        COMPILE::SWF
-        {
-            addChild(component as DisplayObject);
-        }
-        COMPILE::JS
-        {
-            addChild(component as IUIComponent);
-        }
+        addChild(component as IUIComponent);
     }
     
     private function applicationCompleteHandler(event:Event):void
@@ -3560,7 +3587,9 @@ public class SystemManager extends SystemManagerBase implements ISystemManager,
     /**
      *  @private
      */
-    COMPILE::JS 
+    [SWFOverride(params="flash.display.DisplayObject,int", altparams="mx.core.UIComponent,int"))]
+    COMPILE::SWF 
+    { override }
     public function setChildIndex(child:IUIComponent, index:int):void
     {
         if (GOOG::DEBUG)
@@ -3570,16 +3599,27 @@ public class SystemManager extends SystemManagerBase implements ISystemManager,
     /**
      *  @private
      */
-    COMPILE::JS
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent"))]
+    COMPILE::SWF 
+    { override }
     public function getChildIndex(child:IUIComponent):int
     {
-        return getElementIndex(child);
+        COMPILE::JS
+        {
+            return getElementIndex(child);
+        }
+        COMPILE::SWF
+        {
+            return super.getChildIndex(child as DisplayObject);
+        }
     }
     
     /**
      *  @private
      */
-    COMPILE::JS
+    [SWFOverride(returns="flash.display.DisplayObject"))]
+    COMPILE::SWF 
+    { override }
     public function getChildByName(name:String):IUIComponent
     {
         if (GOOG::DEBUG)
@@ -3590,7 +3630,9 @@ public class SystemManager extends SystemManagerBase implements ISystemManager,
     /**
      *  @private
      */
-    COMPILE::JS 
+    [SWFOverride(params="flash.display.DisplayObject", altparams="mx.core.UIComponent"))]
+    COMPILE::SWF 
+    { override }
     public function contains(child:IUIComponent):Boolean
     {
         if (GOOG::DEBUG)


[royale-asjs] 09/09: use to get tests to pass

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 6ebab10f321a28c64c779f93732ed6630f750d6c
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Aug 4 18:18:03 2018 -0700

    use  to get tests to pass
---
 .../projects/MXRoyale/src/main/royale/mx/controls/MenuBar.as     | 9 ++++++++-
 mustella/src/main/royale/UnitTester.as                           | 6 +++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/MenuBar.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/MenuBar.as
index 619d710..5a990ce 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/MenuBar.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/MenuBar.as
@@ -939,7 +939,14 @@ public class MenuBar extends UIComponent implements IFocusManagerComponent, ICon
     public function get menuBarItems():Array
     {
         var arr:Array = [];
-        var itemHolder:UIBase = getChildAt(0) as UIBase;
+        COMPILE::SWF
+        {
+            var itemHolder:UIBase = $getChildAt(0) as UIBase;
+        }
+        COMPILE::JS
+        {
+            var itemHolder:UIBase = getChildAt(0) as UIBase;            
+        }
         var n:int = itemHolder.numElements;
         for (var i:int = 0; i < n; i++)
             arr.push(itemHolder.getElementAt(i));
diff --git a/mustella/src/main/royale/UnitTester.as b/mustella/src/main/royale/UnitTester.as
index 1bdbd84..49ee2bb 100644
--- a/mustella/src/main/royale/UnitTester.as
+++ b/mustella/src/main/royale/UnitTester.as
@@ -1150,7 +1150,11 @@ public class UnitTester extends EventDispatcher
 						var n:int = doc.numChildren;
 						for (var i:int = 0; i < n; i++)
 						{
-							var child:DisplayObject = doc.getChildAt(i);
+							var child:DisplayObject;
+                            if ("$getChildAt" in doc)
+                                child = doc["$getChildAt"](i);
+                            else
+                                child = doc.getChildAt(i);
 							if (swfLoaders[doc] && child is flash.display.Loader)
 							{
 								// if sandboxed then ask it for its targets


[royale-asjs] 02/09: get parameters property working

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit d70affe765de722380936ba3583fe58e53f6654e
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Aug 4 11:03:38 2018 -0700

    get parameters property working
---
 .../src/main/royale/mx/core/Application.as         | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
index 6b74431..b9da637 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
@@ -379,6 +379,49 @@ public class Application extends Container implements IStrand, IParent, IEventDi
 		}
 	}
 	
+    private var _parameters:Object;
+    
+    /**
+     *  The parameters property returns an Object containing name-value
+     *  pairs representing the parameters provided to this Application.
+     *
+     *  <p>You can use a for-in loop to extract all the names and values
+     *  from the parameters Object.</p>
+     *
+     *  <p>There are two sources of parameters: the query string of the
+     *  Application's URL, and the value of the FlashVars HTML parameter
+     *  (this affects only the main Application).</p>
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get parameters():Object
+    {
+        COMPILE::SWF
+        {
+            return loaderInfo.parameters;
+        }
+        COMPILE::JS
+        {
+            if (!_parameters)
+            {
+                _parameters = {};
+                var query:String = location.search.substring(1);
+                if(query)
+                {
+                    var vars:Array = query.split("&");
+                    for (var i:int=0;i<vars.length;i++) {
+                        var pair:Array = vars[i].split("=");
+                        _parameters[pair[0]] = decodeURIComponent(pair[1]);
+                    }
+                }
+            }
+            return _parameters;
+        }
+    }
+
 	/**
 	 *  This method gets called when all preinitialize handlers
 	 *  no longer call preventDefault();


[royale-asjs] 07/09: try being smarter about when to run layouts. If not sized to content or explicitly sized, some other code should end up setting your size which should result in a layout pass

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit e54eca7d701bfa8e142619492b0a9398dd0a9e24
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Aug 4 15:21:55 2018 -0700

    try being smarter about when to run layouts.  If not sized to content or explicitly sized, some other code should end up setting your size which should result in a layout pass
---
 .../main/royale/org/apache/royale/html/beads/PanelView.as   | 13 +++++++++++--
 .../projects/MXRoyale/src/main/royale/mx/containers/Box.as  |  5 ++++-
 .../MXRoyale/src/main/royale/mx/containers/Panel.as         |  8 ++++++--
 .../projects/MXRoyale/src/main/royale/mx/core/Container.as  |  6 +++++-
 4 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
index df42f23..e356e94 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
@@ -219,6 +219,7 @@ package org.apache.royale.html.beads
 				IEventDispatcher(value).addEventListener("heightChanged", handleSizeChange);
 				IEventDispatcher(value).addEventListener("sizeChanged", handleSizeChange);
 				IEventDispatcher(value).addEventListener("childrenAdded", handleChildrenAdded);
+                IEventDispatcher(value).addEventListener("initComplete", handleInitComplete);
 			}
 
             super.strand = value;
@@ -269,11 +270,19 @@ package org.apache.royale.html.beads
 
 			performLayout(event);
 		}
+        
+        private var sawInitComplete:Boolean;
 
 		private function handleChildrenAdded(event:Event):void
 		{
-			_contentArea.dispatchEvent(new Event("layoutNeeded"));
-			performLayout(event);
+            var host:UIBase = _strand as UIBase;
+            if (sawInitComplete || 
+                ((host.isHeightSizedToContent() || !isNaN(host.explicitHeight)) &&
+                    (host.isWidthSizedToContent() || !isNaN(host.explicitWidth))))
+            {
+    			_contentArea.dispatchEvent(new Event("layoutNeeded"));
+	    		performLayout(event);
+            }
 		}
 
 		/**
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Box.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Box.as
index a9a1996..91c69d0 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Box.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Box.as
@@ -203,7 +203,10 @@ public class Box extends Container
 		_layout.direction = value;
 		
 		dispatchEvent(new Event("directionChanged"));
-		dispatchEvent(new Event("layoutNeeded"));
+        if (parent != null &&
+            ((isHeightSizedToContent() || !isNaN(explicitHeight)) &&
+            (isWidthSizedToContent() || !isNaN(explicitWidth))))
+    		dispatchEvent(new Event("layoutNeeded"));
 
     }
 
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
index 9a6a1fd..232af0d 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
@@ -663,7 +663,9 @@ public class Panel extends Container
     {
         var panelView:PanelView = view as PanelView;
         panelView.contentArea.addElement(c, dispatchEvent);
-        panelView.contentArea.dispatchEvent(new Event("layoutNeeded"));
+        if ((isHeightSizedToContent() || !isNaN(explicitHeight)) &&
+            (isWidthSizedToContent() || !isNaN(explicitWidth)))
+            panelView.contentArea.dispatchEvent(new Event("layoutNeeded"));
     }
     
     /**
@@ -674,7 +676,9 @@ public class Panel extends Container
     {
         var panelView:PanelView = view as PanelView;
         panelView.contentArea.addElementAt(c, index, dispatchEvent);
-        panelView.contentArea.dispatchEvent(new Event("layoutNeeded"));
+        if ((isHeightSizedToContent() || !isNaN(explicitHeight)) &&
+            (isWidthSizedToContent() || !isNaN(explicitWidth)))
+            panelView.contentArea.dispatchEvent(new Event("layoutNeeded"));
     }
     
     /**
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
index eae74d8..c5db136 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
@@ -612,7 +612,11 @@ public class Container extends UIComponent
 		
 		// Load the layout bead if it hasn't already been loaded.
 		if (loadBeadFromValuesManager(IBeadLayout, "iBeadLayout", this))
-			dispatchEvent(new Event("layoutNeeded"));
+        {
+            if ((isHeightSizedToContent() || !isNaN(explicitHeight)) &&
+                (isWidthSizedToContent() || !isNaN(explicitWidth)))
+    			dispatchEvent(new Event("layoutNeeded"));
+        }
 	}
 	
     override protected function createChildren():void


[royale-asjs] 08/09: force layout on SWF side

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit be5949478fe6e57d4765a9def948548b4f53e05b
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Aug 4 17:02:37 2018 -0700

    force layout on SWF side
---
 .../projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as    | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as
index 7deb47c..f06a06a 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as
@@ -2903,6 +2903,10 @@ public class SystemManager extends SystemManagerBase implements ISystemManager,
         // until preloader?
         component.addEventListener("applicationComplete", applicationCompleteHandler);
         addChild(component as IUIComponent);
+        COMPILE::SWF
+        {
+            component.setActualSize(stage.stageWidth, stage.stageHeight);            
+        }
     }
     
     private function applicationCompleteHandler(event:Event):void


[royale-asjs] 05/09: also implement fontWeight

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit bac3d84bcdbd594d2889f5f134d0c679b7402690
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Aug 4 12:23:43 2018 -0700

    also implement fontWeight
---
 .../projects/MXRoyale/src/main/royale/mx/core/UIComponent.as      | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index f8567e1..6f58774 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -4049,15 +4049,13 @@ public class UIComponent extends UIBase
      */
     public function get fontWeight():Object
     {
-        if (GOOG::DEBUG)
-            trace("fontWeight not implemented");
-        return 0;
+        return ValuesManager.valuesImpl.getValue(this, "fontWeight");
     }
     public function set fontWeight(value:Object):void
     {
-        if (GOOG::DEBUG)
-            trace("fontWeight not implemented");
+        setStyle("fontWeight", value);
     }
+    
 	[Inspectable(category="General")]
 
 	/*