Update removePopUp method of PopUpUtil to accept a class or an instance.
This commit is contained in:
parent
ad045e95e8
commit
605b47c1af
@ -28,8 +28,13 @@ package org.bigbluebutton.core {
|
|||||||
import mx.managers.PopUpManager;
|
import mx.managers.PopUpManager;
|
||||||
import mx.managers.SystemManager;
|
import mx.managers.SystemManager;
|
||||||
|
|
||||||
|
import org.as3commons.logging.api.ILogger;
|
||||||
|
import org.as3commons.logging.api.getClassLogger;
|
||||||
|
|
||||||
public final class PopUpUtil {
|
public final class PopUpUtil {
|
||||||
|
|
||||||
|
private static const LOGGER:ILogger = getClassLogger(PopUpUtil);
|
||||||
|
|
||||||
private static var popUpDict:Dictionary = new Dictionary(true);
|
private static var popUpDict:Dictionary = new Dictionary(true);
|
||||||
|
|
||||||
public static function createNonModelPopUp(parent:DisplayObject, className:Class, center:Boolean = true):IFlexDisplayObject {
|
public static function createNonModelPopUp(parent:DisplayObject, className:Class, center:Boolean = true):IFlexDisplayObject {
|
||||||
@ -46,14 +51,17 @@ package org.bigbluebutton.core {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function removePopUp(className:Class):void {
|
public static function removePopUp(classOrInstance:*):void {
|
||||||
var fqcn:String = getQualifiedClassName(className);
|
var fqcn:String = getQualifiedClassName(classOrInstance);
|
||||||
if (popUpDict[fqcn] != undefined) {
|
if (popUpDict[fqcn] != undefined) {
|
||||||
PopUpManager.removePopUp(popUpDict[fqcn])
|
PopUpManager.removePopUp(popUpDict[fqcn])
|
||||||
|
delete popUpDict[fqcn];
|
||||||
|
LOGGER.debug("Removed PopUp with type [{0}]", [fqcn]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function checkPopUpExists(className:Class):Boolean {
|
private static function checkPopUpExists(className:Class):Boolean {
|
||||||
|
LOGGER.debug("Checking if [{0}] exists as a PopUp", [className]);
|
||||||
var systemManager:SystemManager = FlexGlobals.topLevelApplication.systemManager;
|
var systemManager:SystemManager = FlexGlobals.topLevelApplication.systemManager;
|
||||||
|
|
||||||
var childList:IChildList = systemManager.rawChildren;
|
var childList:IChildList = systemManager.rawChildren;
|
||||||
@ -61,10 +69,11 @@ package org.bigbluebutton.core {
|
|||||||
var childObject:IUIComponent = childList.getChildAt(i) as IUIComponent;
|
var childObject:IUIComponent = childList.getChildAt(i) as IUIComponent;
|
||||||
// PopUp already exists
|
// PopUp already exists
|
||||||
if (childObject is className && childObject.isPopUp) {
|
if (childObject is className && childObject.isPopUp) {
|
||||||
|
LOGGER.debug("PopUp with type [{0}] found", [className]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LOGGER.debug("No PopUp with type [{0}] not found", [className]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +83,9 @@ package org.bigbluebutton.core {
|
|||||||
PopUpManager.centerPopUp(popUp)
|
PopUpManager.centerPopUp(popUp)
|
||||||
}
|
}
|
||||||
popUpDict[getQualifiedClassName(className)] = popUp;
|
popUpDict[getQualifiedClassName(className)] = popUp;
|
||||||
|
|
||||||
|
LOGGER.debug("Created PopUp with type [{0}]", [className]);
|
||||||
|
|
||||||
return popUp;
|
return popUp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user