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/11/23 07:56:37 UTC

[royale-asjs] 01/03: get PopUpManager to work

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 78855817803126ad12a7a9b45ea54a72575560e2
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Nov 22 23:22:22 2018 -0800

    get PopUpManager to work
---
 .../src/main/royale/mx/managers/PopUpManager.as    | 26 +++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/PopUpManager.as b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/PopUpManager.as
index 73c87b9..7a8f480 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/PopUpManager.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/PopUpManager.as
@@ -24,6 +24,16 @@ package mx.managers
 //import mx.core.IFlexModuleFactory;
 //import mx.core.Singleton;
 import mx.core.IFlexDisplayObject;
+import mx.core.IUIComponent;
+import mx.core.FlexGlobals;
+
+import org.apache.royale.core.IChild;
+import org.apache.royale.core.IPopUpHost;
+import org.apache.royale.core.IStrand;
+import org.apache.royale.core.IUIBase;
+import org.apache.royale.html.beads.plugin.IModalDisplay;
+import org.apache.royale.utils.UIUtils;
+
 
 /**
  *  The PopUpManager singleton class creates new top-level windows and
@@ -129,7 +139,9 @@ public class PopUpManager
                                        childList:String = null,
                                        moduleFactory:Object = null):Object //IFlexModuleFactory = null):IFlexDisplayObject
     {   
-		return null; //impl.createPopUp(parent, className, modal, childList, moduleFactory);
+		var instance:IUIComponent = new className() as IUIComponent;
+        addPopUp(instance, parent, modal);
+        return instance;
     }
     
     /**
@@ -184,7 +196,15 @@ public class PopUpManager
                     childList:String = null,
                     moduleFactory:Object = null):void //IFlexModuleFactory = null):void
     {
-		//impl.addPopUp(window, parent, modal, childList, moduleFactory);
+        var popUpHost:IPopUpHost = UIUtils.findPopUpHost(parent as IUIBase);
+        if (modal)
+        {
+            var appStrand:IStrand = FlexGlobals.topLevelApplication as IStrand;
+            var modalBead:IModalDisplay = appStrand.getBeadByType(IModalDisplay) as IModalDisplay;
+            if (modalBead)
+                modalBead.show(popUpHost);
+        }
+        popUpHost.popUpParent.addElement(window as IUIComponent);
     }
 	
     /**
@@ -223,7 +243,7 @@ public class PopUpManager
 	
     public static function removePopUp(popUp:IFlexDisplayObject):void
     {
-		//impl.removePopUp(popUp);
+		UIUtils.removePopUp(popUp as IChild)
     }
 } // class
 } // package