|
82 |
|
82 |
|
83 |
_lastDepends: null, |
83 |
_lastDepends: null, |
84 |
|
84 |
|
|
|
85 |
_initializingElements: 0, |
86 |
|
85 |
_createHandler: function(ifunc) { |
87 |
_createHandler: function(ifunc) { |
86 |
// This handler will be called by all subwidgets of the MultiInput widget. |
88 |
// This handler will be called by all subwidgets of the MultiInput widget. |
87 |
// When the first request comes in, we will execute the function to compute |
89 |
// When the first request comes in, we will execute the function to compute |
|
149 |
|
151 |
|
150 |
_loadValues: function(depends) { |
152 |
_loadValues: function(depends) { |
151 |
// delegate the call to _loadValues to all widgets |
153 |
// delegate the call to _loadValues to all widgets |
|
|
154 |
console.log('MultiInput: _loadValues: ' + this.id); |
152 |
this._lastDepends = depends; |
155 |
this._lastDepends = depends; |
153 |
dojo.forEach(this._widgets, function(iwidgets) { |
156 |
this._initializingElements = 0; |
|
|
157 |
dojo.forEach(this._widgets, dojo.hitch(this, function(iwidgets) { |
158 |
|
159 |
dojo.forEach(iwidgets, dojo.hitch(this, function(jwidget) { |
160 |
if ('onValuesLoaded' in jwidget && !(jwidget._valuesLoaded && !jwidget._deferredOrValues)) { |
161 |
++this._initializingElements; |
162 |
console.log("MultiInput Init: " + jwidget.id); |
163 |
var handle = this.connect(jwidget, 'onValuesLoaded', dojo.hitch(this, function() { |
164 |
console.log("MultiInput Callback: " + jwidget.id); |
165 |
// disconnect from the signal |
166 |
this.disconnect(handle); |
167 |
|
168 |
// decrement the internal counter |
169 |
--this._initializingElements; |
170 |
|
171 |
// send event when the last element has been initialized |
172 |
if (0 === this._initializingElements) { |
173 |
console.log('MultiInput: top: _initializingElements == 0 ==> calling onValuesLoaded'); |
174 |
this.onValuesLoaded(); |
175 |
} |
176 |
})); |
177 |
} |
178 |
})); |
179 |
|
154 |
dojo.forEach(iwidgets, function(jwidget) { |
180 |
dojo.forEach(iwidgets, function(jwidget) { |
155 |
if ('_loadValues' in jwidget) { |
181 |
if ('_loadValues' in jwidget) { |
156 |
jwidget._loadValues(depends); |
182 |
jwidget._loadValues(depends); |
157 |
} |
183 |
} |
158 |
}); |
184 |
}); |
159 |
}); |
185 |
})); |
|
|
186 |
|
187 |
// maybe all elements are already initialized |
188 |
if (!this._initializingElements) { |
189 |
console.log('MultiInput: bottom: _initializingElements == 0 ==> calling onValuesLoaded'); |
190 |
this.onValuesLoaded(); |
191 |
} |
192 |
}, |
193 |
|
194 |
onValuesLoaded: function() { |
195 |
// event stub |
160 |
}, |
196 |
}, |
161 |
|
197 |
|
162 |
_setAllValues: function(_valList) { |
198 |
_setAllValues: function(_valList) { |
|
400 |
rowContainer.startup(); |
436 |
rowContainer.startup(); |
401 |
this.addChild(rowContainer); |
437 |
this.addChild(rowContainer); |
402 |
|
438 |
|
403 |
// call the _loadValues method by hand |
439 |
// // call the _loadValues method by hand |
404 |
dojo.forEach(order, function(iname) { |
440 |
// dojo.forEach(order, function(iname) { |
405 |
var iwidget = widgets[iname]; |
441 |
// var iwidget = widgets[iname]; |
406 |
if ('_loadValues' in iwidget) { |
442 |
// if ('_loadValues' in iwidget) { |
407 |
iwidget._loadValues(this._lastDepends); |
443 |
// iwidget._loadValues(this._lastDepends); |
408 |
} |
444 |
// } |
409 |
}, this); |
445 |
// }, this); |
|
|
446 |
this._loadValues(this._lastDepends); |
410 |
} |
447 |
} |
411 |
|
448 |
|
412 |
// add the new button |
449 |
// add the new button |