Skip to content
This repository
Browse code

Change setDirection() to direction() and update the direction propert…

…y and the testcases.
  • Loading branch information...
commit cfa799094726ba1f336cb734deec4a671c74117c 1 parent 1f4ac87
Ed Chatelain authored April 13, 2012
4  StatefulSeries.js
@@ -24,8 +24,8 @@ define([
24 24
 					if(lang.isString(target)){
25 25
 						throw new Error("Literal-based dojox/mvc/at is not supported in dojox.mvc.StatefulSeries.");
26 26
 					}
27  
-					if(item.direction && !(item.direction & at.from)){
28  
-						console.warn("Data binding direction option is ignored in dojox.mvc.StatefulSeries.");
  27
+					if(item.bindDirection && !(item.bindDirection & at.from)){
  28
+						console.warn("Data binding bindDirection option is ignored in dojox.mvc.StatefulSeries.");
29 29
 					}
30 30
 					if(targetProp && lang.isFunction(target.set) && lang.isFunction(target.watch)){
31 31
 						var converter = item.converter, formatFunc = (converter || {}).format && lang.hitch({target: target, source: this}, converter.format);
6  _atBindingMixin.js
@@ -141,12 +141,12 @@ define([
141 141
 				// First, establish non-wildcard data bindings
142 142
 				for(var prop in refs){
143 143
 					if(!refs[prop] || prop == "*"){ continue; }
144  
-					atWatchHandles[prop] = bind(refs[prop].target, refs[prop].targetProp, this, prop, {direction: refs[prop].direction, converter: refs[prop].converter});
  144
+					atWatchHandles[prop] = bind(refs[prop].target, refs[prop].targetProp, this, prop, {bindDirection: refs[prop].bindDirection, converter: refs[prop].converter});
145 145
 				}
146 146
 
147 147
 				// Then establish wildcard data bindings
148 148
 				if((refs["*"] || {}).atsignature == "dojox.mvc.at"){
149  
-					atWatchHandles["*"] = bind(refs[prop].target, refs["*"].targetProp, this, "*", {direction: refs["*"].direction, converter: refs["*"].converter});
  149
+					atWatchHandles["*"] = bind(refs[prop].target, refs["*"].targetProp, this, "*", {bindDirection: refs["*"].bindDirection, converter: refs["*"].converter});
150 150
 				}
151 151
 			}
152 152
 		},
@@ -186,7 +186,7 @@ define([
186 186
 
187 187
 			if(this._started){
188 188
 				// If this widget has been started already, establish data binding immediately.
189  
-				atWatchHandles[name] = bind(value.target, value.targetProp, this, name, {direction: value.direction, converter: value.converter});
  189
+				atWatchHandles[name] = bind(value.target, value.targetProp, this, name, {bindDirection: value.bindDirection, converter: value.converter});
190 190
 			}else{
191 191
 				// Otherwise, queue it up to this._refs so that _dbstartup() can pick it up.
192 192
 				this._refs[name] = value;
22  at.js
@@ -17,19 +17,19 @@ define([
17 17
 		//		The property name in target to be synchronized.
18 18
 		targetProp: "",
19 19
 
20  
-		// direction: Number
21  
-		//		The data binding direction, choose from: dojox.mvc.sync.from, dojox.mvc.sync.to or dojox.mvc.sync.both.
22  
-		direction: dojox.mvc.sync.both,
  20
+		// bindDirection: Number
  21
+		//		The data binding bindDirection, choose from: dojox.mvc.sync.from, dojox.mvc.sync.to or dojox.mvc.sync.both.
  22
+		bindDirection: dojox.mvc.sync.both,
23 23
 
24 24
 		// converter: dojox.mvc.sync.converter
25 25
 		//		Class/object containing the converter functions used when the data goes between data binding target (e.g. data model or controller) to data binding origin (e.g. widget).
26 26
 		converter: null,
27 27
 
28  
-		setDirection: function(direction){
  28
+		direction: function(bindDirection){
29 29
 			// summary:
30  
-			//		Sets data binding direction.
31  
-			// direction: Number
32  
-			//		The data binding direction, choose from: dojox.mvc.sync.from, dojox.mvc.sync.to or dojox.mvc.sync.both.
  30
+			//		Sets data binding bindDirection.
  31
+			// bindDirection: Number
  32
+			//		The data binding bindDirection, choose from: dojox.mvc.sync.from, dojox.mvc.sync.to or dojox.mvc.sync.both.
33 33
 		},
34 34
 
35 35
 		transform: function(converter){
@@ -78,9 +78,9 @@ define([
78 78
 			atsignature: "dojox.mvc.at",
79 79
 			target: target,
80 80
 			targetProp: targetProp,
81  
-			direction: sync.both,
82  
-			setDirection: function(/*Number*/ direction){
83  
-				this.direction = direction;
  81
+			bindDirection: sync.both,
  82
+			direction: function(/*Number*/ bindDirection){
  83
+				this.bindDirection = bindDirection;
84 84
 				return this;
85 85
 			},
86 86
 			transform: function(/*dojox.mvc.sync.converter*/ converter){
@@ -90,7 +90,7 @@ define([
90 90
 		}; // dojox.mvc.at.handle
91 91
 	};
92 92
 
93  
-	// Data binding directions
  93
+	// Data binding bindDirections
94 94
 	at.from = sync.from;
95 95
 	at.to = sync.to;
96 96
 	at.both = sync.both;
14  sync.js
@@ -35,9 +35,9 @@ define([
35 35
 		// summary:
36 36
 		//		Data binding options.
37 37
 
38  
-		// direction: Number
39  
-		//		The data binding direction, choose from: dojox.mvc.Bind.from, dojox.mvc.Bind.to or dojox.mvc.Bind.both.
40  
-		direction: dojox.mvc.both,
  38
+		// bindDirection: Number
  39
+		//		The data binding bindDirection, choose from: dojox.mvc.Bind.from, dojox.mvc.Bind.to or dojox.mvc.Bind.both.
  40
+		bindDirection: dojox.mvc.both,
41 41
 
42 42
 		// converter: dojox.mvc.sync.converter
43 43
 		//		Class/object containing the converter functions used when the data goes between data binding target (e.g. data model or controller) to data binding origin (e.g. widget).
@@ -165,7 +165,7 @@ define([
165 165
 		 excludes = [],
166 166
 		 list,
167 167
 		 constraints = lang.mixin({}, target.constraints, source.constraints),
168  
-		 direction = (options || {}).direction || mvc.both,
  168
+		 bindDirection = (options || {}).bindDirection || mvc.both,
169 169
 		 logContent = getLogContent(target, targetProp, source, sourceProp),
170 170
 		 debugDataBinding = dojox.debugDataBinding;
171 171
 
@@ -181,7 +181,7 @@ define([
181 181
 			list = [targetProp];
182 182
 		}
183 183
 
184  
-		if(direction & mvc.from){
  184
+		if(bindDirection & mvc.from){
185 185
 			// Start synchronization from target to source (e.g. from model to widget). For wildcard mode (targetProp == sourceProp == "*"), the 1st argument of watch() is omitted
186 186
 			if(lang.isFunction(target.set) && lang.isFunction(target.watch)){
187 187
 				_watchHandles.push(target.watch.apply(target, ((targetProp != "*") ? [targetProp] : []).concat([function(name, old, current){
@@ -201,8 +201,8 @@ define([
201 201
 			});
202 202
 		}
203 203
 
204  
-		if(direction & mvc.to){
205  
-			if(!(direction & mvc.from)){
  204
+		if(bindDirection & mvc.to){
  205
+			if(!(bindDirection & mvc.from)){
206 206
 				// Initial copy from target to source (e.g. from model to widget)
207 207
 				array.forEach(list, function(prop){
208 208
 					// In "all properties synchronization" case, copy is not done for properties in "exclude" list
6  tests/doh_mvc_loan-stateful.html
@@ -334,7 +334,7 @@ <h1 class="testTitle">doh_mvc_loan-stateful.html automated tests (non-robot)</h1
334 334
 									<div class="cell">
335 335
 										<input id="totalHousing" data-dojo-type="dijit.form.NumberTextBox"
336 336
 										 data-dojo-props="value: at('rel:', 'TotalHousing'),
337  
-										                  disabled: at('rel:', 'TotalHousing').setDirection(at.from).transform(nonZeroRelevanceConverter)"/>
  337
+										                  disabled: at('rel:', 'TotalHousing').direction(at.from).transform(nonZeroRelevanceConverter)"/>
338 338
 									</div>
339 339
 								</div>
340 340
 							</td>
@@ -372,8 +372,8 @@ <h1 class="testTitle">doh_mvc_loan-stateful.html automated tests (non-robot)</h1
372 372
 						<div class="cell">
373 373
 							<input id="percentHousing" data-dojo-type="dijit.form.NumberTextBox"
374 374
 							 data-dojo-props="value: at('rel:', 'HousingPercent'),
375  
-							                  valid: at('rel:', 'HousingPercent').setDirection(at.from).transform(validHousingPercentConverter),
376  
-							                  disabled: at('rel:', 'HousingPercent').setDirection(at.from).transform(nonZeroRelevanceConverter)"
  375
+							                  valid: at('rel:', 'HousingPercent').direction(at.from).transform(validHousingPercentConverter),
  376
+							                  disabled: at('rel:', 'HousingPercent').direction(at.from).transform(nonZeroRelevanceConverter)"
377 377
 							 invalidMessage="Housing should be less than 1/3 total expenses!"/>
378 378
 						</div>
379 379
 					</div>
6  tests/doh_mvc_repeat_select_cancel.html
@@ -307,11 +307,11 @@
307 307
 									</td>
308 308
 									<td class="dijitMenuItemIconCell">
309 309
 										<img id="viewiconimg${index}" src="../../../dojo/resources/blank.gif" data-dojo-type="dijit._WidgetBase"
310  
-										 data-dojo-props="_setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Priority').setDirection(at.from).transform(priorityConverter)">
  310
+										 data-dojo-props="_setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Priority').direction(at.from).transform(priorityConverter)">
311 311
 									</td>
312 312
 									<td id="viewtext${index}" data-dojo-type="dijit._WidgetBase"
313  
-									 data-dojo-props="Subject: at('rel:', 'Subject').setDirection(at.from).transform(subjectConverter),
314  
-									                  _setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Completed').setDirection(at.from).transform(completeConverter),
  313
+									 data-dojo-props="Subject: at('rel:', 'Subject').direction(at.from).transform(subjectConverter),
  314
+									                  _setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Completed').direction(at.from).transform(completeConverter),
315 315
 									                  _setSubjectAttr: {node: 'domNode', type: 'innerText'}">
316 316
 									</td>
317 317
 								</tr>
6  tests/doh_mvc_repeat_select_manualsave.html
@@ -332,11 +332,11 @@
332 332
 									</td>
333 333
 									<td class="dijitMenuItemIconCell">
334 334
 										<img id="viewiconimg${index}" src="../../../dojo/resources/blank.gif" data-dojo-type="dijit._WidgetBase"
335  
-										 data-dojo-props="_setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Priority').setDirection(at.from).transform(priorityConverter)">
  335
+										 data-dojo-props="_setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Priority').direction(at.from).transform(priorityConverter)">
336 336
 									</td>
337 337
 									<td id="viewtext${index}" data-dojo-type="dijit._WidgetBase"
338  
-									 data-dojo-props="Subject: at('rel:', 'Subject').setDirection(at.from).transform(subjectConverter),
339  
-									                  _setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Completed').setDirection(at.from).transform(completeConverter),
  338
+									 data-dojo-props="Subject: at('rel:', 'Subject').direction(at.from).transform(subjectConverter),
  339
+									                  _setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Completed').direction(at.from).transform(completeConverter),
340 340
 									                  _setSubjectAttr: {node: 'domNode', type: 'innerText'}">
341 341
 									</td>
342 342
 								</tr>
2  tests/doh_new-mvc_label_and_totals.html
@@ -239,7 +239,7 @@
239 239
 			</div>
240 240
 			<div class="row">
241 241
 				<label data-dojo-type="dojox.mvc.Output" class="cell" for="ageInput" id="ageOutput"
242  
-					data-dojo-props="value: at('rel:', 'First').setDirection(at.from).transform(ageLabelConverter)"></label>
  242
+					data-dojo-props="value: at('rel:', 'First').direction(at.from).transform(ageLabelConverter)"></label>
243 243
 				<input class="cell" id="ageInput" data-dojo-type="dijit.form.TextBox" 
244 244
 					data-dojo-props="value: at('rel:', 'Age')">
245 245
 			</div>
2  tests/mobile/demo/demo.html
@@ -262,7 +262,7 @@ <h1 data-dojo-type="dojox/mobile/Heading" data-dojo-props='back:"Back", moveTo:"
262 262
 							<div id="view" data-dojo-type="dojox/mvc/Generate"
263 263
 				 				data-dojo-props="widgetMapping:{'String' : 'dojox/mobile/TextBox'},
264 264
 				 					idNameMapping: {String: 'TB'},
265  
-				 					children: at('widget:modelArea', 'value').setDirection(at.from).transform({format: dojo.fromJson})">
  265
+				 					children: at('widget:modelArea', 'value').direction(at.from).transform({format: dojo.fromJson})">
266 266
 				 			</div>
267 267
 						</div>
268 268
 						<div class="fieldset">
2  tests/mobile/demo/src.js
@@ -164,7 +164,7 @@ var repeatData = [
164 164
 	var genmodel;
165 165
 	updateView = function() {
166 166
 		try {
167  
-			registry.byId("view").set("children", at('widget:modelArea', 'value').setDirection(at.from).transform({format: dojo.fromJson}));
  167
+			registry.byId("view").set("children", at('widget:modelArea', 'value').direction(at.from).transform({format: dojo.fromJson}));
168 168
 			dom.byId("outerModelArea").style.display = "none";
169 169
 			dom.byId("viewArea").style.display = "";              		
170 170
 		}catch(err){
2  tests/multiattrib/doh_mvc_test_Toolbar.html
@@ -161,7 +161,7 @@ <h1 class="testTitle">Toolbar test</h1>
161 161
 
162 162
 	<div style="margin-top:8px;">
163 163
 		Change the state for "Bold" (but this check box is free from change in the tool bar):
164  
-		<input id="checkBold" data-dojo-type="dijit.form.CheckBox" checked data-dojo-props="checked: at(boldItemModel, 'checked').setDirection(at.to)">
  164
+		<input id="checkBold" data-dojo-type="dijit.form.CheckBox" checked data-dojo-props="checked: at(boldItemModel, 'checked').direction(at.to)">
165 165
 	</div>
166 166
 
167 167
 	<div style="margin-top:8px;">
2  tests/multiattrib/doh_mvc_test_Toolbar_withCtrl.html
@@ -158,7 +158,7 @@ <h1 class="testTitle">Toolbar test</h1>
158 158
 
159 159
 	<div style="margin-top:8px;">
160 160
 		Change the state for "Bold" (but this check box is free from change in the tool bar):
161  
-		<input id="checkBold" data-dojo-type="dijit.form.CheckBox" checked data-dojo-props="checked: at(boldItemCtrl, 'checked').setDirection(at.to)">
  161
+		<input id="checkBold" data-dojo-type="dijit.form.CheckBox" checked data-dojo-props="checked: at(boldItemCtrl, 'checked').direction(at.to)">
162 162
 	</div>
163 163
 
164 164
 	<div style="margin-top:8px;">
2  tests/multiattrib/test_Toolbar.html
@@ -113,7 +113,7 @@ <h1 class="testTitle">Toolbar test</h1>
113 113
 	<div style="margin-top:8px;">
114 114
 		Change the state for "Bold" (but this check box is free from change in the tool bar):
115 115
 		<input data-dojo-type="dijit.form.CheckBox" checked 
116  
-				data-dojo-props="checked: at(boldItemModel, 'checked').setDirection(at.to)">
  116
+				data-dojo-props="checked: at(boldItemModel, 'checked').direction(at.to)">
117 117
 	</div>
118 118
 
119 119
 	<div style="margin-top:8px;">
2  tests/test_mvc_Element.html
@@ -63,7 +63,7 @@
63 63
 	<div>
64 64
 		<div>
65 65
 			Text:
66  
-			<span data-mvc-bindings="class: at(boldTextModel, 'checked').setDirection(at.from).transform({format: function(value){ return value ? 'boldText' : ''; }}),
  66
+			<span data-mvc-bindings="class: at(boldTextModel, 'checked').direction(at.from).transform({format: function(value){ return value ? 'boldText' : ''; }}),
67 67
 			                         value: at(titleModel, 'value')"></span>
68 68
 		</div>
69 69
 		<div>
2  tests/test_mvc_generate-view.html
@@ -73,7 +73,7 @@
73 73
 				</div>
74 74
 				<h3>Generated View</h3>
75 75
 				<div data-dojo-type="dojox.mvc.Generate"
76  
-				 data-dojo-props="children: at('widget:textarea', 'value').setDirection(at.from).transform({format: dojo.fromJson}), idNameMapping: {String: 'view_t'}"></div>
  76
+				 data-dojo-props="children: at('widget:textarea', 'value').direction(at.from).transform({format: dojo.fromJson}), idNameMapping: {String: 'view_t'}"></div>
77 77
 			</div>
78 78
 		</div>
79 79
 	</body>
2  tests/test_mvc_new_label_and_totals.html
@@ -185,7 +185,7 @@
185 185
 			</div>
186 186
 			<div class="row">
187 187
 				<label data-dojo-type="dojox.mvc.Output" class="cell" for="ageInput"
188  
-					data-dojo-props="value: at('rel:', 'First').setDirection(at.from).transform(ageLabelConverter)"></label>
  188
+					data-dojo-props="value: at('rel:', 'First').direction(at.from).transform(ageLabelConverter)"></label>
189 189
 				<input class="cell" id="ageInput" data-dojo-type="dijit.form.TextBox" 
190 190
 					data-dojo-props="value: at('rel:', 'Age')">
191 191
 			</div>
6  tests/test_mvc_new_loan-stateful.html
@@ -239,7 +239,7 @@
239 239
 									<div class="cell">
240 240
 										<input id="totalHousing" data-dojo-type="dijit.form.NumberTextBox"
241 241
 										 data-dojo-props="value: at('rel:', 'TotalHousing'),
242  
-										                  disabled: at('rel:', 'TotalHousing').setDirection(at.from).transform(nonZeroRelevanceConverter)"/>
  242
+										                  disabled: at('rel:', 'TotalHousing').direction(at.from).transform(nonZeroRelevanceConverter)"/>
243 243
 									</div>
244 244
 								</div>
245 245
 							</td>
@@ -280,8 +280,8 @@
280 280
 						<div class="cell">
281 281
 							<input id="percentHousing" data-dojo-type="dijit.form.NumberTextBox"
282 282
 							 data-dojo-props="value: at('rel:', 'HousingPercent'),
283  
-							                  valid: at('rel:', 'HousingPercent').setDirection(at.from).transform(validHousingPercentConverter),
284  
-							                  disabled: at('rel:', 'HousingPercent').setDirection(at.from).transform(nonZeroRelevanceConverter)"
  283
+							                  valid: at('rel:', 'HousingPercent').direction(at.from).transform(validHousingPercentConverter),
  284
+							                  disabled: at('rel:', 'HousingPercent').direction(at.from).transform(nonZeroRelevanceConverter)"
285 285
 							 invalidMessage="Housing should be less than 1/3 total expenses!"/>
286 286
 						</div>
287 287
 					</div>
6  tests/test_mvc_repeat_select.html
@@ -233,11 +233,11 @@
233 233
 									</td>
234 234
 									<td class="dijitMenuItemIconCell">
235 235
 										<img src="../../../dojo/resources/blank.gif" data-dojo-type="dijit._WidgetBase"
236  
-										 data-dojo-props="_setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:${index}', 'Priority').setDirection(at.from).transform(priorityConverter)">
  236
+										 data-dojo-props="_setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:${index}', 'Priority').direction(at.from).transform(priorityConverter)">
237 237
 									</td>
238 238
 									<td data-dojo-type="dijit._WidgetBase"
239  
-									 data-dojo-props="Subject: at('rel:${index}', 'Subject').setDirection(at.from).transform(subjectConverter),
240  
-									                  _setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:${index}', 'Completed').setDirection(at.from).transform(completeConverter),
  239
+									 data-dojo-props="Subject: at('rel:${index}', 'Subject').direction(at.from).transform(subjectConverter),
  240
+									                  _setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:${index}', 'Completed').direction(at.from).transform(completeConverter),
241 241
 									                  _setSubjectAttr: {node: 'domNode', type: 'innerText'}">
242 242
 									</td>
243 243
 								</tr>
6  tests/test_mvc_repeat_select_cancel.html
@@ -250,11 +250,11 @@
250 250
 									</td>
251 251
 									<td class="dijitMenuItemIconCell">
252 252
 										<img src="../../../dojo/resources/blank.gif" data-dojo-type="dijit._WidgetBase"
253  
-										 data-dojo-props="_setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Priority').setDirection(at.from).transform(priorityConverter)">
  253
+										 data-dojo-props="_setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Priority').direction(at.from).transform(priorityConverter)">
254 254
 									</td>
255 255
 									<td data-dojo-type="dijit._WidgetBase"
256  
-									 data-dojo-props="Subject: at('rel:', 'Subject').setDirection(at.from).transform(subjectConverter),
257  
-									                  _setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Completed').setDirection(at.from).transform(completeConverter),
  256
+									 data-dojo-props="Subject: at('rel:', 'Subject').direction(at.from).transform(subjectConverter),
  257
+									                  _setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Completed').direction(at.from).transform(completeConverter),
258 258
 									                  _setSubjectAttr: {node: 'domNode', type: 'innerText'}">
259 259
 									</td>
260 260
 								</tr>
6  tests/test_mvc_repeat_select_manualsave.html
@@ -256,11 +256,11 @@
256 256
 									</td>
257 257
 									<td class="dijitMenuItemIconCell">
258 258
 										<img src="../../../dojo/resources/blank.gif" data-dojo-type="dijit._WidgetBase"
259  
-										 data-dojo-props="_setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Priority').setDirection(at.from).transform(priorityConverter)">
  259
+										 data-dojo-props="_setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Priority').direction(at.from).transform(priorityConverter)">
260 260
 									</td>
261 261
 									<td data-dojo-type="dijit._WidgetBase"
262  
-									 data-dojo-props="Subject: at('rel:', 'Subject').setDirection(at.from).transform(subjectConverter),
263  
-									                  _setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Completed').setDirection(at.from).transform(completeConverter),
  262
+									 data-dojo-props="Subject: at('rel:', 'Subject').direction(at.from).transform(subjectConverter),
  263
+									                  _setDomClassAttr: {node: 'domNode', type: 'class'}, domClass: at('rel:', 'Completed').direction(at.from).transform(completeConverter),
264 264
 									                  _setSubjectAttr: {node: 'domNode', type: 'innerText'}">
265 265
 									</td>
266 266
 								</tr>

0 notes on commit cfa7990

Please sign in to comment.
Something went wrong with that request. Please try again.