1 /** 2 * @ignore 3 */ 4 var Ozone = Ozone ? Ozone : {}; 5 6 /** 7 * @ignore 8 * @namespace 9 */ 10 Ozone.launcher = Ozone.launcher ? Ozone.launcher : {}; 11 12 Ozone.launcher.WidgetLauncherContainer = function(eventingContainer) { 13 14 this.launchChannelName = "_WIDGET_LAUNCHER_CHANNEL"; 15 this.windowManager = null; 16 17 if (eventingContainer != null) { 18 this.eventingContainer = eventingContainer; 19 //register on widget launcher channel 20 var scope = this; 21 this.eventingContainer.registerHandler(this.launchChannelName, function(sender, msg) { 22 return scope.launchWidget(Ozone.util.parseJson(sender), Ozone.util.parseJson(msg)); 23 }); 24 } 25 else { 26 throw { 27 name :'WidgetLauncherContainerException', 28 message :'eventingContainer is null' 29 } 30 } 31 32 }; 33 34 Ozone.launcher.WidgetLauncherContainer.prototype = { 35 36 launchWidget: function(sender, cfg) { 37 var window_manager = null; 38 var returnValue = null; 39 40 //find window_manager for now there will only ever be one 41 window_manager = this.windowManager; 42 43 if (window_manager != null) { 44 45 returnValue = window_manager.launchWidgetInstance(sender, cfg); 46 } 47 else { 48 throw { 49 name :'WidgetLauncherContainerException', 50 message :'window_manager is null' 51 }; 52 } 53 54 //call launch function on the window_manager 55 return returnValue; 56 }, 57 58 registerWindowManager: function(window_manager) { 59 this.windowManager = window_manager; 60 } 61 }; 62