aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage-user/ui/repetition.reel/repetition.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage-user/ui/repetition.reel/repetition.js')
-rwxr-xr-xnode_modules/montage-user/ui/repetition.reel/repetition.js1156
1 files changed, 1156 insertions, 0 deletions
diff --git a/node_modules/montage-user/ui/repetition.reel/repetition.js b/node_modules/montage-user/ui/repetition.reel/repetition.js
new file mode 100755
index 00000000..3405a3d7
--- /dev/null
+++ b/node_modules/montage-user/ui/repetition.reel/repetition.js
@@ -0,0 +1,1156 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6/**
7 @module "montage/ui/repetition.reel"
8 @requires montage/core/core
9 @requires montage/ui/component
10 @requires montage/ui/template
11 @requires montage/core/logger
12 @requires montage/core/gate
13*/
14var Montage = require("montage").Montage,
15 Component = require("ui/component").Component,
16 Template = require("ui/template").Template,
17 logger = require("core/logger").logger("repetition"),
18 Gate = require("core/gate").Gate;
19/**
20 @class module:"montage/ui/repetition.reel".Repetition
21 @extends module:montage/ui/component.Component
22 */
23var Repetition = exports.Repetition = Montage.create(Component, /** @lends module:"montage/ui/repetition.reel".Repetition# */{
24 /**
25 Description TODO
26 */
27 hasTemplate: {value: false},
28
29/**
30 @private
31*/
32 _hasBeenDeserialized: {
33 value: false,
34 enumerable: false
35 },
36
37/**
38 Description TODO
39 @private
40*/
41 _nextDeserializedItemIx: {
42 enumerable: false,
43 value: 0,
44 distinct: true
45 },
46/**
47 Description TODO
48 @function
49 @returns itself
50 */
51 init: {
52 enumerable: false,
53 value: function() {
54 this._items = [];
55 this._itemsToAppend = [];
56 this._nextDeserializedItemIx = 0;
57 this._itemsToRemove = [];
58 this._deletedItems = [];
59 return this;
60 }
61 },
62/**
63 Description TODO
64 @private
65*/
66 _contentController: {
67 enumerable: false,
68 value: null
69 },
70/**
71 The collection of items managed the Repetition.
72 @type {Function}
73 @default null
74 */
75 contentController: {
76 enumerable: false,
77 get: function() {
78 return this._contentController;
79 },
80 set: function(value) {
81 if (this._contentController === value) {
82 return;
83 }
84
85 if (this._contentController) {
86 Object.deleteBinding(this, "objects");
87 Object.deleteBinding(this, "selectedIndexes");
88 Object.deleteBinding(this, "selections");
89 }
90
91 this._contentController = value;
92
93 if (this._contentController) {
94
95 // If we're already getting contentController related values from other bindings...stop that
96 if (this._bindingDescriptors) {
97 Object.deleteBinding(this, "objects");
98 }
99
100 // And bind what we need from the new contentController
101 var objectsBindingDescriptor,
102 selectedIndexesBindingDescriptor,
103 selectionsBindingDescriptor;
104
105 objectsBindingDescriptor = {
106 boundObject: this._contentController,
107 boundObjectPropertyPath: "organizedObjects",
108 oneway: true
109 };
110
111 selectedIndexesBindingDescriptor = {
112 boundObject: this._contentController,
113 boundObjectPropertyPath: "selectedIndexes"
114 };
115
116 selectionsBindingDescriptor = {
117 boundObject: this._contentController,
118 boundObjectPropertyPath: "selections"
119 };
120
121 // If we're ready for bindings...go ahead an install
122 // TODO: Look at changing this once the new serialization has been implemented
123 if (this._hasBeenDeserialized) {
124 Object.defineBinding(this, "objects", objectsBindingDescriptor);
125 Object.defineBinding(this, "selectedIndexes", selectedIndexesBindingDescriptor);
126 Object.defineBinding(this, "selections", selectionsBindingDescriptor);
127 } else {
128 // otherwise we need to defer it until later; we haven't been deserialized yet
129 if (!this._controllerBindingsToInstall) {
130 this._controllerBindingsToInstall = {};
131 }
132
133 this._controllerBindingsToInstall.objects = objectsBindingDescriptor;
134 this._controllerBindingsToInstall.selectedIndexes = selectedIndexesBindingDescriptor;
135 this._controllerBindingsToInstall.selections = selectionsBindingDescriptor;
136 }
137 }
138
139 //TODO otherwise if no contentController should we disable selections?
140
141 }
142 },
143/**
144 Description TODO
145 @private
146*/
147 _objects: {
148 enumerable: false,
149 serializable: true,
150 value: null
151 },
152/**
153 Description TODO
154 @type {Function}
155 @default null
156 */
157 objects: {
158 enumerable: false,
159 get: function() {
160 return this._objects;
161 },
162 set: function(value) {
163 if (logger.isDebug) {
164 logger.debug(this, " set objects:", (value ? value.length : null), value, "same objects?", value === this._objects);
165 }
166 this._objects = value;
167
168 // Objects have changed, clear the selectedIndexes, if we're managing our own selection
169 if (!this.contentController) {
170 this.selectedIndexes = null;
171 }
172
173 if (this._isComponentExpanded) {
174 this._refreshItems();
175 }
176
177 },
178 modify: function(modificationType, newValue, oldValue) {
179 this.selectedIndexes = null;
180
181 if (this._isComponentExpanded) {
182 this._refreshItems();
183 }
184 }
185 },
186/**
187 Description TODO
188 @private
189*/
190 _isSelectionEnabled: {
191 enumerable: false,
192 value: false
193 },
194/**
195 Description TODO
196 @type {Function}
197 @default {Boolean} false
198 */
199 isSelectionEnabled: {
200 get: function() {
201 return this._isSelectionEnabled;
202 },
203 set: function(value) {
204 if (value === this._isSelectionEnabled) {
205 return;
206 }
207
208 this._isSelectionEnabled = value;
209
210 if (this._isComponentExpanded) {
211 this._refreshSelectionTracking();
212 }
213 }
214 },
215/**
216 Description TODO
217 @private
218*/
219 _childLoadedCount: {