11define ( [
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 ) {
0 commit comments