Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit aecee22

Browse files
authored
Merge pull request #31 from vietduc1441/removedeprecated
Remove deprecated
2 parents 9e9ed63 + 6ec4bc9 commit aecee22

7 files changed

Lines changed: 303 additions & 303 deletions

File tree

src/TreeView/widget/Commons.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
define([
22
"dojo/_base/declare",
33
"dojo/data/util/simpleFetch",
4-
], function(declare) {
4+
], function (declare) {
55
"use strict";
66

77
var Commons = declare("TreeView.widget.Commons", null, {
88
//MX5 hack
9-
fixObjProps : function(widget, props) {
9+
fixObjProps: function (widget, props) {
1010
logger.debug("TreeView.widget.Commons.fixObjProps");
1111

1212
var args = {};
@@ -29,7 +29,7 @@ define([
2929
}
3030
},
3131

32-
getEnumMap : function(classname, attrname) {
32+
getEnumMap: function (classname, attrname) {
3333
logger.debug("TreeView.widget.Commons.getEnumMap");
3434

3535
var meta = mx.meta.getEntity(classname);
@@ -48,23 +48,23 @@ define([
4848
* @param {[type]} data [datamap object to be attached to the domnode]
4949
* @return {[type]} node [description]
5050
*/
51-
renderLabel : function(name, close, data) {
51+
renderLabel: function (name, close, data) {
5252
logger.debug("TreeView.widget.Commons.renderLabel");
5353

5454
var n = mxui.dom.create(
5555
"span",
56-
{"class": "gv_label"},
56+
{ "class": "gv_label" },
5757
mxui.dom.create(
5858
"span",
59-
{"class": "gv_label_name"},
59+
{ "class": "gv_label_name" },
6060
name ? name : ""
6161
)
6262
);
6363

6464
if (close) {
6565
dojo.place(mxui.dom.create(
6666
"span",
67-
{"class": "gv_label_close"},
67+
{ "class": "gv_label_close" },
6868
"x"
6969
), n);
7070
}
@@ -73,7 +73,7 @@ define([
7373
return n;
7474
},
7575

76-
getAttributeType : function(classnameOrObject, attr) {
76+
getAttributeType: function (classnameOrObject, attr) {
7777
logger.debug("TreeView.widget.Commons.getAttributeType");
7878

7979
var parts = attr.split("/");
@@ -93,7 +93,7 @@ define([
9393
return false;
9494
},
9595

96-
getObjectAttr : function(object, attr, renderValue) {
96+
getObjectAttr: function (object, attr, renderValue) {
9797
logger.debug("TreeView.widget.Commons.getObjectAttr");
9898

9999
if (!object || !attr) {
@@ -156,7 +156,7 @@ define([
156156
throw "GridCommons.getObjectAttr: Failed to retrieve attribute '" + attr + "'";
157157
},
158158

159-
objectToGuid : function(thing) {
159+
objectToGuid: function (thing) {
160160
logger.debug("TreeView.widget.Commons.objectToGuid");
161161

162162
if (!thing) {
@@ -181,7 +181,7 @@ define([
181181
* @param {Function} callback [callback function]
182182
* @return {[type]} [description]
183183
*/
184-
store : function(object, attr, value, mode, commit, callback) {
184+
store: function (object, attr, value, mode, commit, callback) {
185185
logger.debug("TreeView.widget.Commons.store");
186186

187187
var res = false;
@@ -192,7 +192,7 @@ define([
192192
var cb = function () {
193193
left -= 1;
194194
if (left < 1) {
195-
mendix.lang.nullExec(callback);
195+
callback && callback();
196196
}
197197
};
198198

@@ -231,10 +231,10 @@ define([
231231
}
232232

233233
switch (mode) {
234-
case "add" :
234+
case "add":
235235
res = object.addReferences(attr, guids);
236236
break;
237-
case "rem" :
237+
case "rem":
238238
res = object.removeReferences(attr, guids);
239239
break;
240240
default:
@@ -263,7 +263,7 @@ define([
263263
mxobj: object,
264264
error: this.error,
265265
callback: function () {
266-
mendix.lang.nullExec(callback);
266+
callback && callback();
267267
}
268268
});
269269
}
@@ -277,7 +277,7 @@ define([
277277
* @param {[type]} event [description]
278278
* @param {[type]} map of className -> function(node, event) -> boolean. (If false, further event are stopped)
279279
*/
280-
liveConnect : function(widget, node, event, map) {
280+
liveConnect: function (widget, node, event, map) {
281281
logger.debug("TreeView.widget.Commons.liveConnect");
282282

283283
if (!node) {
@@ -314,11 +314,11 @@ define([
314314
* @param {[type]} message [description]
315315
* @param {Function} callback [description]
316316
*/
317-
confirm : function(message, callback, yescaption, nocaption) {
317+
confirm: function (message, callback, yescaption, nocaption) {
318318
logger.debug("TreeView.widget.Commons.confirm");
319319

320320
if (!message) {
321-
mendix.lang.nullExec(callback);
321+
callback && callback();
322322
return;
323323
}
324324

@@ -330,7 +330,7 @@ define([
330330
});
331331
},
332332

333-
mf : function(mfname, data, callback, context, mfNeedsList, progressMessage) {
333+
mf: function (mfname, data, callback, context, mfNeedsList, progressMessage) {
334334
logger.debug("TreeView.widget.Commons.mf");
335335

336336
//firing on multiple items? wait for all items to finish
@@ -379,7 +379,7 @@ define([
379379
}
380380
},
381381

382-
configError : function(widget, msg) {
382+
configError: function (widget, msg) {
383383
logger.debug("TreeView.widget.Commons.configError");
384384

385385
msg = "Configuration error in " + widget.id + ": " + msg;
@@ -390,7 +390,7 @@ define([
390390
throw msg;
391391
},
392392

393-
error : function(e) {
393+
error: function (e) {
394394
logger.debug("TreeView.widget.Commons.error");
395395

396396
console.error(e);
@@ -400,7 +400,7 @@ define([
400400
/**
401401
* splits the given properties up to objects in target per index. First property indicates targetobjects name
402402
*/
403-
splitPropsTo : function(widget, propnames, target) {
403+
splitPropsTo: function (widget, propnames, target) {
404404
logger.debug("TreeView.widget.Commons.splitPropsTo");
405405

406406
var props = propnames.split(",");
@@ -436,13 +436,13 @@ define([
436436
* @param {[function(object, guid)]} cb to be invoked when resolved [description]
437437
* @return {[type]} [description]
438438
*/
439-
normalizeContext : function(data, cb) {
439+
normalizeContext: function (data, cb) {
440440
logger.debug("TreeView.widget.Commons.normalizeContext");
441441

442442
//Nothing
443443
if (data == null) {
444444
cb(null, null);
445-
} else if (typeof(data) != "object" && /^\d+$/.test(data)) { //GUid only
445+
} else if (typeof (data) != "object" && /^\d+$/.test(data)) { //GUid only
446446
mx.data.get({
447447
guid: data,
448448
callback: function (mxobj) {

src/TreeView/widget/Commons/RelatedDataset.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
define([
22
"dojo/_base/declare",
33
"TreeView/widget/Commons"
4-
], function(declare, Commons) {
4+
], function (declare, Commons) {
55
"use strict"
66

77
return declare("TreeView.widget.Commons.RelatedDataset", null, {
@@ -40,7 +40,7 @@ define([
4040
this.widget.connect(this.widget, "update", dojo.hitch(this, function (data, cb) {
4141
this.contextGuid = data && data.getGuid ? data.getGuid() : data;
4242
this.fetchLabels();
43-
mendix.lang.nullExec(cb);
43+
cb && cb();
4444
}));
4545
},
4646

@@ -53,7 +53,7 @@ define([
5353
},
5454

5555
getValue: function (item, _) {
56-
if (typeof (item) == "object"){
56+
if (typeof (item) == "object") {
5757
return item.get(this.relnameattr);
5858
} else if (/^\d+$/.test(item)) {
5959
var obj = this.existingLabelsById[item]; //assuming guid
@@ -69,7 +69,7 @@ define([
6969
},
7070

7171
fetchLabels: function () {
72-
if (this.contextGuid == null || this._fetchingLabels){
72+
if (this.contextGuid == null || this._fetchingLabels) {
7373
return;
7474
}
7575
this.hasData = false;
@@ -98,12 +98,12 @@ define([
9898
this.existingLabels[label.toLowerCase()] = obj;
9999
this.existingLabelsById[value] = obj;
100100

101-
return {value: value, label: label};
101+
return { value: value, label: label };
102102
}, this);
103103

104104
this._fetchingLabels = false;
105105

106-
if (this.relnewitemcaption){
106+
if (this.relnewitemcaption) {
107107
this.existingOptions.splice(0, 0, {
108108
value: "new",
109109
label: this.relnewitemcaption,
@@ -136,9 +136,9 @@ define([
136136
callback: dojo.hitch(this, function (label) {
137137
var cb = callback
138138
? dojo.hitch(this, callback, {
139-
value: label.getGuid(),
140-
label: labelname
141-
})
139+
value: label.getGuid(),
140+
label: labelname
141+
})
142142
: null;
143143

144144
if (this.relcontextassoc)
@@ -163,7 +163,7 @@ define([
163163

164164
fetchItemByIdentity: function (args) {
165165
//TODO: check and error handling
166-
if (!this.existingLabelsById){
166+
if (!this.existingLabelsById) {
167167
args.onItem.call(args.scope, null);
168168
} else {
169169
args.onItem.call(args.scope, this.existingLabelsById[args.identity]);
@@ -173,10 +173,11 @@ define([
173173
/* Simplefetch api */
174174
_fetchItems: function (query, resultcallback) {
175175
var results = [];
176-
if (this.existingLabels != null){
177-
for (var key in this.existingLabels){
178-
if (key.indexOf(query.query.name.toLowerCase()) === 0){
179-
results.push(this.existingLabels[key]);}
176+
if (this.existingLabels != null) {
177+
for (var key in this.existingLabels) {
178+
if (key.indexOf(query.query.name.toLowerCase()) === 0) {
179+
results.push(this.existingLabels[key]);
180+
}
180181
}
181182
}
182183
resultcallback(results, query);

0 commit comments

Comments
 (0)