aboutsummaryrefslogtreecommitdiff
path: root/js/panels/binding/edit-binding-view.reel/edit-binding-view.js
diff options
context:
space:
mode:
authorJon Reid2012-06-26 14:58:10 -0700
committerJon Reid2012-06-26 14:58:10 -0700
commit2599f74d72293b809929d8a0b36fb8e721f194cd (patch)
treeca4cd45b23b8debea32f95d7dea807c77b6633b2 /js/panels/binding/edit-binding-view.reel/edit-binding-view.js
parentab9d14780eed98f39786fae4518e69861b34bad7 (diff)
parente4304b9ac6c58802de4dd334be1f5802533f5160 (diff)
downloadninja-2599f74d72293b809929d8a0b36fb8e721f194cd.tar.gz
Merge remote-tracking branch 'ninja-jduran/TimelineUber' into timeline-local
Diffstat (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js')
-rw-r--r--js/panels/binding/edit-binding-view.reel/edit-binding-view.js359
1 files changed, 359 insertions, 0 deletions
diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js
new file mode 100644
index 00000000..4b20f74a
--- /dev/null
+++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js
@@ -0,0 +1,359 @@
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
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component,
9 Converter = require("montage/core/converter/converter").Converter;
10
11
12var editBindingView = exports.EditBindingView = Montage.create(Component, {
13 sourceObjectIconElement : { value: null },
14 boundObjectIconElement : { value: null },
15
16 objectIdentifiers : {
17 value: null
18 },
19 getObjectIdentifiers : {
20 value: function() {
21 return this.application.ninja.objectsController.objects.map(function(object) {
22 return object.identifier;
23 });
24 }
25 },
26
27 /* -------------------
28 Object Identifier (for associating with object)
29 ------------------- */
30
31 _sourceObjectIdentifier : { value: null },
32 sourceObjectIdentifier : {
33 get : function() { return this._sourceObjectIdentifier; },
34 set : function(value) {
35 if(value === this._sourceObjectIdentifier) { return; }
36
37 this._sourceObjectIdentifier = value;
38
39 this.needsDraw = true;
40 }
41 },
42
43 _boundObjectIdentifier : { value: null },
44 boundObjectIdentifier : {
45 get : function() { return this._boundObjectIdentifier; },
46 set : function(value) {
47 if(value === this._boundObjectIdentifier) { return; }
48
49 this._boundObjectIdentifier = value;
50
51 this.needsDraw = true;
52 }
53 },
54
55
56 /* -------------------
57 Binding Properties
58 ------------------- */
59
60 _sourceObject : { value: null },
61 sourceObject : {
62 get : function() { return this._sourceObject; },
63 set : function(value) {
64 if(value === this._sourceObject) { return; }
65
66 this._sourceObject = value;
67
68 if(value) {
69 this.sourceObjectPropertyPathField.hints = this.application.ninja.objectsController.getPropertiesFromObject(value);
70 }
71
72 this.needsDraw = true;
73 }
74 },
75
76 _boundObject : { value: null },
77 boundObject : {
78 get : function() { return this._boundObject; },
79 set : function(value) {
80 if(value === this._boundObject) { return; }
81 this._boundObject = value;
82
83 if(value) {
84 this.boundObjectPropertyPathField.hints = this.application.ninja.objectsController.getPropertiesFromObject(value);
85 }
86
87 this.needsDraw = true;
88 }
89 },
90
91 _sourceObjectPropertyPath : { value: null },
92 sourceObjectPropertyPath : {
93 get : function() { return this._sourceObjectPropertyPath; },
94 set : function(value) {
95 if(value === this._sourceObjectPropertyPath) { return; }
96
97 this._sourceObjectPropertyPath = value;
98
99 this.needsDraw = true;
100 }
101 },
102
103 _boundObjectPropertyPath : { value: null },
104 boundObjectPropertyPath : {
105 get : function() { return this._boundObjectPropertyPath; },
106 set : function(value) {
107 if(value === this._boundObjectPropertyPath) { return; }
108
109 this._boundObjectPropertyPath = value;
110
111 this.needsDraw = true;
112 }
113 },
114
115 _oneway: {
116 value: null
117 },
118 oneway: {
119 get: function() {
120 return this._oneway;
121 },
122 set: function(value) {
123 if(value === this._oneway) { return; }
124
125 this._oneway = !!value;
126
127 this.needsDraw = true;
128 }
129 },
130
131 /* -------------------
132 Binding Args Object
133 ------------------- */
134
135 _bindingArgs : {
136 value: null
137 },
138 bindingArgs :{
139 get: function() {
140 return this._bindingArgs;
141 },
142 set: function(value) {
143 if(value === this._bindingArgs) { return; }
144
145 // clear form values
146 this.clearForm();
147
148 this._bindingArgs = value;
149
150 if(value) {
151 // set up hints for hintable components
152 this.objectIdentifiers = this.getObjectIdentifiers();
153 this.boundObjectField.hints = this.objectIdentifiers;
154 this.sourceObjectField.hints = this.objectIdentifiers;
155
156 if(value.sourceObject) {
157 this.sourceObjectIdentifier = value.sourceObject.identifier || value.sourceObject._montage_metadata.label;
158 this.sourceObjectPropertyPath = value.sourceObjectPropertyPath || '';
159 }
160
161 if(value.boundObject) {
162 this.boundObjectIdentifier = value.boundObject.identifier || '';
163 this.boundObjectPropertyPath = value.boundObjectPropertyPath || '';
164 this.isNewBinding = false;
165 } else {
166 this.isNewBinding = true;
167 }
168
169 this.oneway = value.oneway;
170 }
171
172 this.needsDraw = true;
173 }
174 },
175
176 /* -------------------
177 Form properties
178 ------------------- */
179
180 dirty: { value: null },
181 isNewBinding : { value: null },
182
183 "sourceObjectField" : {value: null, enumerable: true },
184 "boundObjectField" : {value: null, enumerable: true },
185 "sourceObjectPropertyPathField" : {value: null, enumerable: true },
186 "boundObjectPropertyPathField" : {value: null, enumerable: true },
187 "directionCheckbox" : {value: null, enumerable: true },
188 "deleteButton" : {value: null },
189 "saveButton" : {value: null },
190 "cancelButton" : {value: null },
191
192 clearForm : {
193 value: function() {
194 var fields = ["sourceObjectField",
195 "boundObjectField",
196 "sourceObjectPropertyPathField",
197 "boundObjectPropertyPathField"];
198
199 fields.forEach(function(fieldName) {
200 this[fieldName].value = "";
201 }, this);
202
203 this._bindingArgs = null;
204
205 this.dirty = false;
206 }