src/js/init.js
changeset 863 dc5e0ea0093c
parent 842 4ae2247a59f4
child 944 8a6c9e3d0158
equal deleted inserted replaced
859:002a16ff171b 863:dc5e0ea0093c
   151   if (IriSP.null_or_undefined(default_options))
   151   if (IriSP.null_or_undefined(default_options))
   152     default_options = {};
   152     default_options = {};
   153   
   153   
   154   var ret_widgets = [];
   154   var ret_widgets = [];
   155   var index;
   155   var index;
   156   
   156   for (index = 0; index < guiOptions.widgets.length; index++) {
   157   for (index = 0; index < guiOptions.widgets.length; index++) {    
       
   158     var widget = IriSP.instantiateWidget(popcornInstance, serialFactory, layoutManager, guiOptions.widgets[index], default_options);
   157     var widget = IriSP.instantiateWidget(popcornInstance, serialFactory, layoutManager, guiOptions.widgets[index], default_options);
   159    
   158    
   160     ret_widgets.push(widget);   
   159     ret_widgets.push(widget);
   161   };
   160   };
   162 
   161 
   163   return ret_widgets;
   162   return ret_widgets;
   164 };
   163 };
   165 
   164 
   191     @param widgetConfig configuration options for the widget
   190     @param widgetConfig configuration options for the widget
   192     @param defaultOptions a dictionnary with some options defined for every widget.
   191     @param defaultOptions a dictionnary with some options defined for every widget.
   193  */
   192  */
   194 IriSP.instantiateWidget = function(popcornInstance, serialFactory, layoutManager, widgetConfig, defaultOptions) {
   193 IriSP.instantiateWidget = function(popcornInstance, serialFactory, layoutManager, widgetConfig, defaultOptions) {
   195 
   194 
   196     if (IriSP.null_or_undefined(defaultOptions))
   195     if (IriSP.null_or_undefined(defaultOptions)) {
   197       defaultOptions = {};
   196       defaultOptions = {};
       
   197     }
       
   198     if (IriSP.null_or_undefined(widgetConfig)) {
       
   199       return;
       
   200     }
   198     
   201     
   199     widgetConfig = IriSP.underscore.defaults(widgetConfig, defaultOptions);
   202     widgetConfig = IriSP.underscore.defaults(widgetConfig, defaultOptions);
   200 
   203 
   201     var arr = IriSP.jQuery.extend({}, widgetConfig);
   204     var arr = IriSP.jQuery.extend({}, widgetConfig);
   202     
   205