This is an automated email from the ASF dual-hosted git repository. aharui pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 8c947c91b9e50129a676cc54be601d0b45dc3048 Author: Alex Harui <[email protected]> AuthorDate: Tue Aug 13 17:27:23 2019 -0700 change UIComponent.component to UIComponent.mxmlDocument and get it to work better. Fixes #440 --- .../src/main/royale/mx/controls/RadioButton.as | 2 +- .../MXRoyale/src/main/royale/mx/core/Container.as | 3 +- .../src/main/royale/mx/core/IUIComponent.as | 4 +- .../src/main/royale/mx/core/UIComponent.as | 52 +++++++++++----------- .../src/main/royale/mx/managers/ISystemManager.as | 4 +- .../src/main/royale/mx/managers/SystemManager.as | 28 ++++++------ .../royale/spark/components/SkinnableContainer.as | 2 +- .../spark/components/supportClasses/GroupBase.as | 2 +- 8 files changed, 48 insertions(+), 49 deletions(-) diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/RadioButton.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/RadioButton.as index 4c19e74..46ab092 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/RadioButton.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/RadioButton.as @@ -316,7 +316,7 @@ public class RadioButton extends Button { if (_group == null) { - _group = component[groupName]; + _group = mxmlDocument[groupName]; } return _group; } 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 69a88df..1dfeb3b 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as @@ -771,7 +771,6 @@ public class Container extends UIComponent //-------------------------------------------------------------------------- private var _mxmlDescriptor:Array; - private var _mxmlDocument:Object = this; override public function addedToParent():void { @@ -781,7 +780,7 @@ public class Container extends UIComponent } if (MXMLDescriptor) - component = this; + _mxmlDocument = this; super.addedToParent(); diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as index 555dbbe..b2d7a68 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as @@ -55,12 +55,12 @@ public interface IUIComponent extends IFlexDisplayObject, IChild, IUIBase * @playerversion AIR 1.1 * @productversion Flex 3 */ - function get component():Object + function get mxmlDocument():Object /** * @private */ - function set component(value:Object):void + function set mxmlDocument(value:Object):void //---------------------------------- // enabled 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 ec5c4fd..7503af4 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as @@ -1847,7 +1847,7 @@ COMPILE::JS * so that their 'document' property refers to the document object * that they are inside. */ - private var _component:Object; + protected var _mxmlDocument:Object; [Inspectable(environment="none")] @@ -1861,9 +1861,9 @@ COMPILE::JS * @playerversion AIR 1.1 * @productversion Flex 3 */ - public function get component():Object + public function get mxmlDocument():Object { - return _component; + return _mxmlDocument; } /** @@ -1876,7 +1876,7 @@ COMPILE::JS * @playerversion AIR 1.1 * @productversion Flex 3 */ - public function set component(value:Object):void + public function set mxmlDocument(value:Object):void { var n:int = numChildren; for (var i:int = 0; i < n; i++) @@ -1888,14 +1888,14 @@ COMPILE::JS if (child == this) continue; - if (child.component == _component || - child.component == FlexGlobals.topLevelApplication) + if (child.mxmlDocument == _mxmlDocument || + child.mxmlDocument == FlexGlobals.topLevelApplication) { - child.component = value; + child.mxmlDocument = value; } } - _component = value; + _mxmlDocument = value; } @@ -1915,10 +1915,10 @@ COMPILE::JS initialized = true; } - if (!component && parent is UIComponent) - component = UIComponent(parent).component; - else if (!component && parent is ContainerContentArea) - component = UIComponent(ContainerContentArea(parent).parent).component; + if (!mxmlDocument && parent is UIComponent) + mxmlDocument = UIComponent(parent).mxmlDocument; + else if (!mxmlDocument && parent is ContainerContentArea) + mxmlDocument = UIComponent(ContainerContentArea(parent).parent).mxmlDocument; } //---------------------------------- @@ -1966,7 +1966,7 @@ COMPILE::JS { // Look for the SystemManager's document, // which should be the Application. - var o:Object = systemManager.component; + var o:Object = systemManager.mxmlDocument; // If this UIComponent is its own root, then it is an Application. // We want to return its parent Application, or null @@ -1983,7 +1983,7 @@ COMPILE::JS if (o == this) { var p:UIComponent = o.systemManager.parent as UIComponent; - o = p ? p.systemManager.component : null; + o = p ? p.systemManager.mxmlDocument : null; } return o; @@ -2015,23 +2015,23 @@ COMPILE::JS * @playerversion AIR 1.1 * @productversion Flex 3 */ - public function get parentComponent():Object + public function get parentMxmlDocument():Object { - if (component == this) + if (mxmlDocument == this) { var p:IUIComponent = parent as IUIComponent; if (p) - return p.component; + return p.mxmlDocument; var sm:ISystemManager = parent as ISystemManager; if (sm) - return sm.component; + return sm.mxmlDocument; return null; } else { - return component; + return mxmlDocument; } } @@ -5547,10 +5547,10 @@ COMPILE::JS // The document setter will recursively set it on any // descendants of the child that exist. if (child is IUIComponent && - !IUIComponent(child).component) + !IUIComponent(child).mxmlDocument) { - IUIComponent(child).component = component ? - component : + IUIComponent(child).mxmlDocument = mxmlDocument ? + mxmlDocument : FlexGlobals.topLevelApplication; } @@ -5560,8 +5560,8 @@ COMPILE::JS if (moduleFactory != null) IFlexModule(child).moduleFactory = moduleFactory; - else if (component is IFlexModule && component.moduleFactory != null) - IFlexModule(child).moduleFactory = component.moduleFactory; + else if (mxmlDocument is IFlexModule && mxmlDocument.moduleFactory != null) + IFlexModule(child).moduleFactory = mxmlDocument.moduleFactory; else if (parent is IFlexModule && IFlexModule(parent).moduleFactory != null) IFlexModule(child).moduleFactory = IFlexModule(parent).moduleFactory; @@ -5682,8 +5682,8 @@ COMPILE::JS { // only reset document if the child isn't // a document itself - if (IUIComponent(child).component != child) - IUIComponent(child).component = null; + if (IUIComponent(child).mxmlDocument != child) + IUIComponent(child).mxmlDocument = null; //IUIComponent(child).parentChanged(null); } } diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/ISystemManager.as b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/ISystemManager.as index a4926fa..4327efa 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/ISystemManager.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/ISystemManager.as @@ -94,12 +94,12 @@ public interface ISystemManager extends IEventDispatcher, IChildList /*, IFlexMo * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ - function get component():Object; + function get mxmlDocument():Object; /** * @private */ - function set component(value:Object):void; + function set mxmlDocument(value:Object):void; function get rawChildren():IChildList; function get numModalWindows():int; function set numModalWindows(value:int):void; 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 5339328..a89f7ea 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as @@ -823,9 +823,9 @@ public class SystemManager extends SystemManagerBase implements ISystemManager, /** * @private - * Storage for the component property. + * Storage for the mxmlDocument property. */ - private var _component:Object; + private var _mxmlDocument:Object; /** * @inheritDoc @@ -835,17 +835,17 @@ public class SystemManager extends SystemManagerBase implements ISystemManager, * @playerversion AIR 1.1 * @productversion Royale 0.9.4 */ - public function get component():Object + public function get mxmlDocument():Object { - return _component; + return _mxmlDocument; } /** * @private */ - public function set component(value:Object):void + public function set mxmlDocument(value:Object):void { - _component = value; + _mxmlDocument = value; } //---------------------------------- @@ -2731,7 +2731,7 @@ public class SystemManager extends SystemManagerBase implements ISystemManager, private function kickOff():void { // already been here - if (component) + if (mxmlDocument) return; /* @@ -2976,16 +2976,16 @@ public class SystemManager extends SystemManagerBase implements ISystemManager, */ private function initializeTopLevelWindow(event:Event):void { - component = IUIComponent(create()); + mxmlDocument = IUIComponent(create()); if (SystemManagerGlobals.parameters) - component["parameters"] = SystemManagerGlobals.parameters; + mxmlDocument["parameters"] = SystemManagerGlobals.parameters; // until preloader? - component.addEventListener("applicationComplete", applicationCompleteHandler); - component.moduleFactory = this; - addChild(component as IUIComponent); + mxmlDocument.addEventListener("applicationComplete", applicationCompleteHandler); + mxmlDocument.moduleFactory = this; + addChild(mxmlDocument as IUIComponent); var screen:Rectangle = this.screen; - component.setActualSize(screen.width, screen.height); + mxmlDocument.setActualSize(screen.width, screen.height); } private function applicationCompleteHandler(event:Event):void @@ -3725,7 +3725,7 @@ public class SystemManager extends SystemManagerBase implements ISystemManager, */ public function get popUpHost():IPopUpHost { - return component as IPopUpHost; + return mxmlDocument as IPopUpHost; } // TODO is this right? Otherwise UIUtils.findPopUpHost() won't stop here. diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as index 5f8ecb4..8890b13 100644 --- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as +++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as @@ -1014,7 +1014,7 @@ public class SkinnableContainer extends SkinnableComponent implements IContainer } if (MXMLDescriptor) - component = this; + mxmlDocument = this; super.addedToParent(); diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/GroupBase.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/GroupBase.as index 48882f0..69f7d17 100644 --- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/GroupBase.as +++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/GroupBase.as @@ -1189,7 +1189,7 @@ public class GroupBase extends UIComponent implements ILayoutParent, IContainer } if (MXMLDescriptor) - component = this; + mxmlDocument = this; super.addedToParent();
