aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/repetition.reel/repetition.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/ui/repetition.reel/repetition.js')
-rwxr-xr-xnode_modules/montage/ui/repetition.reel/repetition.js188
1 files changed, 90 insertions, 98 deletions
diff --git a/node_modules/montage/ui/repetition.reel/repetition.js b/node_modules/montage/ui/repetition.reel/repetition.js
index c278e84d..ce58036a 100755
--- a/node_modules/montage/ui/repetition.reel/repetition.js
+++ b/node_modules/montage/ui/repetition.reel/repetition.js
@@ -128,8 +128,6 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
128 128
129 didCreate: { 129 didCreate: {
130 value: function() { 130 value: function() {
131 var self = this;
132
133 this.addPropertyChangeListener("objects", this); 131 this.addPropertyChangeListener("objects", this);
134 this._fakeObjects = Object.create(FakeObjects).initWithRepetition(this); 132 this._fakeObjects = Object.create(FakeObjects).initWithRepetition(this);
135 } 133 }
@@ -184,7 +182,7 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
184 handleChange: { 182 handleChange: {
185 enumerable: false, 183 enumerable: false,
186 value: function(notification) { 184 value: function(notification) {
187 if (this._isComponentExpanded) { 185 if ("objects" === notification.currentPropertyPath && this._isComponentExpanded) {
188 this._updateItems(notification.minus, notification.plus, notification.index || 0); 186 this._updateItems(notification.minus, notification.plus, notification.index || 0);
189 } 187 }
190 } 188 }
@@ -232,7 +230,6 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
232 @private 230 @private
233*/ 231*/
234 _contentController: { 232 _contentController: {
235 enumerable: false,
236 value: null 233 value: null
237 }, 234 },
238/** 235/**
@@ -241,7 +238,6 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
241 @default null 238 @default null
242 */ 239 */
243 contentController: { 240 contentController: {
244 enumerable: false,
245 get: function() { 241 get: function() {
246 return this._contentController; 242 return this._contentController;
247 }, 243 },
@@ -253,7 +249,6 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
253 if (this._contentController) { 249 if (this._contentController) {
254 Object.deleteBinding(this, "objects"); 250 Object.deleteBinding(this, "objects");
255 Object.deleteBinding(this, "selectedIndexes"); 251 Object.deleteBinding(this, "selectedIndexes");
256 Object.deleteBinding(this, "selections");
257 } 252 }
258 253
259 this._contentController = value; 254 this._contentController = value;
@@ -267,8 +262,7 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
267 262
268 // And bind what we need from the new contentController 263 // And bind what we need from the new contentController
269 var objectsBindingDescriptor, 264 var objectsBindingDescriptor,
270 selectedIndexesBindingDescriptor, 265 selectedIndexesBindingDescriptor;
271 selectionsBindingDescriptor;
272 266
273 objectsBindingDescriptor = { 267 objectsBindingDescriptor = {
274 boundObject: this._contentController, 268 boundObject: this._contentController,
@@ -281,17 +275,12 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
281 boundObjectPropertyPath: "selectedIndexes" 275 boundObjectPropertyPath: "selectedIndexes"
282 }; 276 };
283 277
284 selectionsBindingDescriptor = {
285 boundObject: this._contentController,
286 boundObjectPropertyPath: "selections"
287 };
288
289 // If we're ready for bindings...go ahead an install 278 // If we're ready for bindings...go ahead an install
290 // TODO: Look at changing this once the new serialization has been implemented 279 // TODO: Look at changing this once the new serialization has been implemented
291 if (this._hasBeenDeserialized) { 280 if (this._hasBeenDeserialized) {
292 Object.defineBinding(this, "objects", objectsBindingDescriptor); 281 Object.defineBinding(this, "objects", objectsBindingDescriptor);
293 Object.defineBinding(this, "selectedIndexes", selectedIndexesBindingDescriptor); 282 Object.defineBinding(this, "selectedIndexes", selectedIndexesBindingDescriptor);
294 Object.defineBinding(this, "selections", selectionsBindingDescriptor); 283
295 } else { 284 } else {
296 // otherwise we need to defer it until later; we haven't been deserialized yet 285 // otherwise we need to defer it until later; we haven't been deserialized yet
297 if (!this._controllerBindingsToInstall) { 286 if (!this._controllerBindingsToInstall) {
@@ -300,13 +289,13 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
300 289
301 this._controllerBindingsToInstall.objects = objectsBindingDescriptor; 290 this._controllerBindingsToInstall.objects = objectsBindingDescriptor;
302 this._controllerBindingsToInstall.selectedIndexes = selectedIndexesBindingDescriptor; 291 this._controllerBindingsToInstall.selectedIndexes = selectedIndexesBindingDescriptor;
303 this._controllerBindingsToInstall.selections = selectionsBindingDescriptor;
304 } 292 }
305 } 293 }
306 294
307 //TODO otherwise if no contentController should we disable selections? 295 //TODO otherwise if no contentController should we disable selections?
308 296
309 } 297 },
298 serializable: true
310 }, 299 },
311/** 300/**
312 Description TODO 301 Description TODO
@@ -314,13 +303,11 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
314*/ 303*/
315 _objects: { 304 _objects: {
316 enumerable: false, 305 enumerable: false,
317 serializable: true,
318 value: null 306 value: null
319 }, 307 },
320 308
321 _mappedObjects: { 309 _mappedObjects: {
322 enumerable: false, 310 enumerable: false,
323 serializable: true,
324 value: null 311 value: null
325 }, 312 },
326/** 313/**
@@ -359,7 +346,8 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
359 //if (this._isComponentExpanded) { 346 //if (this._isComponentExpanded) {
360 // this._refreshItems(); 347 // this._refreshItems();
361 //} 348 //}
362 } 349 },
350 serializable: true
363 }, 351 },
364/** 352/**
365 Description TODO 353 Description TODO
@@ -388,7 +376,8 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
388 if (this._isComponentExpanded) { 376 if (this._isComponentExpanded) {
389 this._refreshSelectionTracking(); 377 this._refreshSelectionTracking();
390 } 378 }
391 } 379 },
380 serializable: true
392 }, 381 },
393/** 382/**
394 Description TODO 383 Description TODO
@@ -449,7 +438,8 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
449 this._indexMapEnabled = value; 438 this._indexMapEnabled = value;
450 439
451 this.refreshIndexMap(); 440 this.refreshIndexMap();
452 } 441 },
442 serializable: true
453 }, 443 },
454 444
455 _drawnIndexMap: { 445 _drawnIndexMap: {
@@ -646,21 +636,6 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
646 } 636 }
647 }, 637 },
648 638
649 _deleteItems: {
650 value: function(minus, index) {
651 if (this._updatingItems) {
652 return;
653 }
654 this._updatingItems = true;
655
656 for (var i = 0, l = minus.length; i < l; i++) {
657 this._deleteItem(index + i);
658 }
659
660 this._updatingItems = false;
661 }
662 },
663
664/** 639/**
665 Description TODO 640 Description TODO
666 @private 641 @private
@@ -717,9 +692,6 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
717 childComponent.needsDraw = true; 692 childComponent.needsDraw = true;
718 childComponent.loadComponentTree(function() { 693 childComponent.loadComponentTree(function() {
719 if (++self._childLoadedCount === self._expectedChildComponentsCount) { 694 if (++self._childLoadedCount === self._expectedChildComponentsCount) {
720//if(self.identifier == "repetition13") {
721// debugger
722//}
723 canDrawGate.setField("iterationLoaded", true); 695 canDrawGate.setField("iterationLoaded", true);
724 self.needsDraw = true; 696 self.needsDraw = true;
725 } 697 }
@@ -734,38 +706,77 @@ var Repetition = exports.Repetition = Montage.create(Component, /** @lends modul
734*/ 706*/
735 _deleteItem: { 707 _deleteItem: {
736 value: function(index) { 708 value: function(index) {
737 var deletedItem, itemIndex, removedComponents, childComponents = this.childComponents, childComponentsCount = this._iterationChildComponentsCount, 709 var deletedItem,
738 itemsToAppendCount = this._itemsToAppend.length; 710 itemIndex = index,
739