142 @param serialFactory serializer factory to instantiate the widget with |
142 @param serialFactory serializer factory to instantiate the widget with |
143 @param layoutManager layout manager |
143 @param layoutManager layout manager |
144 @param widgetConfig configuration options for the widget |
144 @param widgetConfig configuration options for the widget |
145 */ |
145 */ |
146 IriSP.instantiateWidget = function(popcornInstance, serialFactory, layoutManager, widgetConfig) { |
146 IriSP.instantiateWidget = function(popcornInstance, serialFactory, layoutManager, widgetConfig) { |
147 /* create div returns us a container for the widget and a spacer */ |
|
148 var ret = layoutManager.createDiv(widgetConfig.type); |
|
149 var container = ret[0]; |
|
150 var spacer = ret[1]; |
|
151 |
147 |
152 var arr = IriSP.jQuery.extend({}, widgetConfig); |
148 var arr = IriSP.jQuery.extend({}, widgetConfig); |
153 arr.container = container; |
|
154 arr.spacer = spacer; |
|
155 arr.layoutManager = layoutManager; |
|
156 |
149 |
|
150 /* create a div for those widgets who didn't already specify a container; */ |
|
151 if (!arr.hasOwnProperty("container")) { |
|
152 /* create div returns us a container for the widget and a spacer */ |
|
153 var ret = layoutManager.createDiv(widgetConfig.type); |
|
154 var container = ret[0]; |
|
155 var spacer = ret[1]; |
|
156 arr.container = container; |
|
157 arr.spacer = spacer; |
|
158 arr.layoutManager = layoutManager; |
|
159 } |
157 var serializer = serialFactory.getSerializer(widgetConfig.metadata); |
160 var serializer = serialFactory.getSerializer(widgetConfig.metadata); |
158 |
161 |
159 if (typeof serializer == "undefined") |
162 if (typeof serializer == "undefined") |
160 debugger; |
163 debugger; |
161 |
164 |