aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/controller
diff options
context:
space:
mode:
authorPierre Frisch2011-12-22 07:25:50 -0800
committerValerio Virgillito2012-01-27 11:18:17 -0800
commitb89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch)
tree0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /node_modules/montage/ui/controller
parent2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff)
downloadninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/controller')
-rwxr-xr-xnode_modules/montage/ui/controller/array-controller.js796
-rwxr-xr-xnode_modules/montage/ui/controller/media-controller.js698
-rwxr-xr-xnode_modules/montage/ui/controller/object-controller.js62
-rwxr-xr-xnode_modules/montage/ui/controller/paged-array-controller.js260
4 files changed, 1816 insertions, 0 deletions
diff --git a/node_modules/montage/ui/controller/array-controller.js b/node_modules/montage/ui/controller/array-controller.js
new file mode 100755
index 00000000..98b0c66f
--- /dev/null
+++ b/node_modules/montage/ui/controller/array-controller.js
@@ -0,0 +1,796 @@
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/controller/array-controller
8 @requires montage/core/core
9 @requires montage/ui/controller/object-controller
10 @requires montage/core/event/mutable-event
11 */
12var Montage = require("montage").Montage,
13 ObjectController = require("ui/controller/object-controller").ObjectController,
14 MutableEvent = require("core/event/mutable-event").MutableEvent;
15/**
16 The ArrayController helps with organizing a collection of objects, and managing user selection within that collection.
17 TYou can assign an ArrayController instance as the <code>contentProvider</code> property for a Montage List or Repetition object.
18 @class module:montage/ui/controller/array-controller.ArrayController
19 @classdesc
20 @extends module:montage/ui/controller/object-controller.ObjectController
21*/
22var ArrayController = exports.ArrayController = Montage.create(ObjectController, /** @lends module:montage/ui/controller/array-controller.ArrayController# */ {
23
24 /**
25 @private
26 */
27 _content: {
28 enumerable: false,
29 value: null
30 },
31 /**
32 The content managed by the ArrayController.
33 @type {Function}
34 @default {String} null
35 */
36 content: {
37 get: function() {
38 return this._content;
39 },
40 set: function(value) {
41
42 if (this._content === value) {
43 return;
44 }
45
46 this._content = value;
47
48 //TODO for right now assume that any content change invalidates the selection completely; we'll need to address this of course
49 this.selectedObjects = null;
50
51 this.organizeObjects();
52 }
53 },
54
55 /**
56 The user-defined delegate object for the ArrayController.<br>
57 If a delegate object exists, the ArrayController will notify the delegate of changes to the collection, or the selection.<br>
58 Currently, the only supported delegate method is <code>shouldChangeSelection</code>, which passes the new and old selected objects.<br>
59 If the function returns false the selection action is canceled.
60 @type {Object}
61 @default null
62 @example
63 var ArrayController = require("ui/controller/array-controller").ArrayController;
64 var controller = ArrayController.create();
65 controller.delegate = Montage.create(Object.prototype, {
66 shouldChangeSelection: function(newObj, oldObj) {
67 console.log("New object is", newObj, "Old object is", oldObj);
68 }
69 })
70 */
71 delegate: {
72 value: null
73 },
74
75 /**
76 @private
77 */
78 _organizedObjects: {
79 enumerable: false,
80 value: null
81 },
82
83 /**
84 The filtered and sorted content of the ArrayCollection.
85 @type {Function}
86 @default null
87 */
88 organizedObjects: {
89 enumerable: false,
90 get: function() {
91
92 if (this._organizedObjects) {
93 return this._organizedObjects;
94 }
95
96 this.organizeObjects();
97
98 return this._organizedObjects;
99 }
100 },
101
102 /**
103 Specifies whether the ArrayCollection's content is automatically organized (false, by default).
104 @type {Property}
105 @default {Boolean} false
106 */
107 automaticallyOrganizeObjects: {
108 value: false
109 },
110
111 /**
112 @private
113 */
114 _sortFunction: {
115 enumerable: false,
116 value: null
117 },
118
119 /**
120 The sort function used to organize the array collection.
121 @type {Function}
122 @default null
123 @version 1.0
124 */
125 sortFunction: {
126 get: function() {
127 return this._sortFunction;
128 },
129 set: function(value) {
130
131 if (this._sortFunction === value) {
132 return;
133 }
134
135 this._sortFunction = value;
136
137 if (this.automaticallyOrganizeObjects) {
138 this.organizeObjects();
139 }
140 }
141 },
142
143 /**
144 @private
145 */
146 _filterFunction: {
147 enumerable: false,
148 value: null
149 },
150
151 /**
152 The filter function used to organize the array collection.
153 @type {Function}
154 @default null
155 @version 1.0
156 */
157 filterFunction: {
158 get: function() {
159 return this._filterFunction;
160 },
161 set: function(value) {
162
163 if (this._filterFunction === value) {
164 return;
165 }
166
167 this._filterFunction = value;
168
169 if (this.automaticallyOrganizeObjects) {
170 this.organizeObjects();
171 }
172 }
173 },
174
175 /**
176 @private
177 */
178 _startIndex: {
179 enumerable: false,
180 value: null
181 },
182
183 /**
184 The start index of the organized objects.
185 @type {Function}
186 @default null
187 @version 1.0
188 */
189 startIndex: {
190 enumerable: false,
191 get: function() {
192 return this._startIndex;
193 },
194 set: function(value) {
195
196 if (this._startIndex === value) {
197 return;
198 }
199
200 this._startIndex = value;
201
202 if (this.automaticallyOrganizeObjects) {
203 this.organizeObjects();
204 }
205 }
206 },
207
208 /**
209 @private
210 */
211 _endIndex: {
212 enumerable: false,
213 value: null
214 },
215