88        //MX5 hack 
99        fixObjProps  : function ( widget ,  props )  { 
1010            logger . debug ( "TreeView.widget.Commons.fixObjProps" ) ; 
11+ 
1112            var  args  =  { } ; 
1213
1314            for  ( var  i  =  0 ;  i  <  props . length ;  i ++ )  { 
@@ -30,6 +31,7 @@ define([
3031
3132        getEnumMap  : function ( classname ,  attrname )  { 
3233            logger . debug ( "TreeView.widget.Commons.getEnumMap" ) ; 
34+ 
3335            var  meta  =  mx . meta . getEntity ( classname ) ; 
3436
3537            if  ( this . getAttributeType ( classname ,  attrname )  !=  "Enum" )  { 
@@ -48,6 +50,7 @@ define([
4850         */ 
4951        renderLabel  : function ( name ,  close ,  data )  { 
5052            logger . debug ( "TreeView.widget.Commons.renderLabel" ) ; 
53+ 
5154            var  n  =  mxui . dom . create ( 
5255                "span" , 
5356                { "class" : "gv_label" } , 
@@ -58,26 +61,30 @@ define([
5861                ) 
5962            ) ; 
6063
61-             if  ( close ) 
64+             if  ( close )   { 
6265                dojo . place ( mxui . dom . create ( 
6366                    "span" , 
6467                    { "class" : "gv_label_close" } , 
6568                    "x" 
6669                ) ,  n ) ; 
70+             } 
6771
6872            mxui . dom . data ( n ,  "data" ,  data ) ; 
6973            return  n ; 
7074        } , 
7175
7276        getAttributeType  : function ( classnameOrObject ,  attr )  { 
7377            logger . debug ( "TreeView.widget.Commons.getAttributeType" ) ; 
78+ 
7479            var  parts  =  attr . split ( "/" ) ; 
75-             if  ( parts . length  ==  3 ) 
76-                 return  this . getAttributeType ( parts [ 1 ] ,  parts [ 2 ] ) 
80+             if  ( parts . length  ==  3 )  { 
81+                 return  this . getAttributeType ( parts [ 1 ] ,  parts [ 2 ] ) ; 
82+             } 
7783
7884            if  ( attr . indexOf ( "/" )  ==  - 1 )  { 
79-                 if  ( classnameOrObject . getEntity ) 
85+                 if  ( classnameOrObject . getEntity )   { 
8086                    classnameOrObject  =  classnameOrObject . getEntity ( ) ; 
87+                 } 
8188
8289                var  meta  =  mx . meta . getEntity ( classnameOrObject ) ; 
8390                return  meta . getAttributeType ( attr ) ; 
@@ -88,20 +95,24 @@ define([
8895
8996        getObjectAttr  : function ( object ,  attr ,  renderValue )  { 
9097            logger . debug ( "TreeView.widget.Commons.getObjectAttr" ) ; 
91-             if  ( ! object  ||  ! attr ) 
98+ 
99+             if  ( ! object  ||  ! attr )  { 
92100                return  "" ; 
101+             } 
93102
94103            if  ( attr . indexOf ( "/" )  ==  - 1 )  { 
95-                 if  ( renderValue ) 
104+                 if  ( renderValue )   { 
96105                    return  mx . parser  &&  mx . parser . formatAttribute  ? mx . parser . formatAttribute ( object ,  attr )  : mxui . html . renderValue ( object ,  attr ) ;  //mxui.html.rendervalue moved in 5.~7. 
106+                 } 
97107                return  object . get ( attr ) ; 
98108            } 
99109            var  parts  =  attr . split ( "/" ) ; 
100110            if  ( parts . length  ==  3 )  { 
101111                var  child  =  object . getReference ( parts [ 0 ] ) ; 
102112
103-                 if  ( ! child ) 
113+                 if  ( ! child )   { 
104114                    return  "" ; 
115+                 } 
105116
106117                //Fine, we have an object 
107118                if  ( dojo . isObject ( child ) )  { 
@@ -118,8 +129,9 @@ define([
118129                            tmp  =  obj ; 
119130                        } 
120131                    } ) ; 
121-                     if  ( tmp  !=  null )  //callback was invoked in sync :) 
132+                     if  ( tmp  !=  null )  { //callback was invoked in sync :) 
122133                        return  this . getObjectAttr ( tmp ,  parts [ 2 ] ,  renderValue ) ; 
134+                     } 
123135
124136                    //console && console.warn && console.warn("Commons.getObjectAttr failed to retrieve " + attr ); 
125137                    //This happens if no retrieve schema was used :-(. 
@@ -131,27 +143,31 @@ define([
131143            //objects can be returned in X different ways, sometime just a guid, sometimes its an object... 
132144            if  ( parts . length  ==  2 )  { 
133145                var  result  =  object . getReferences ( parts [ 0 ] ) ;  //incase of of a get object, return the Guids (but sometimes getAttribute gives the object...) 
134-                 if  ( ! result  ||  result . length  ==  0 ) 
146+                 if  ( ! result  ||  result . length  ==  0 )   { 
135147                    return  "" ; 
136-                 if  ( result . guid ) 
148+                 } 
149+                 if  ( result . guid )  { 
137150                    return  result . guid ; 
138-                 if  ( / \d + / . test ( result ) ) 
151+                 } 
152+                 if  ( / \d + / . test ( result ) )  { 
139153                    return  result ; 
154+                 } 
140155            } 
141156            throw  "GridCommons.getObjectAttr: Failed to retrieve attribute '"  +  attr  +  "'" ; 
142- 
143157        } , 
144158
145159        objectToGuid  : function ( thing )  { 
146160            logger . debug ( "TreeView.widget.Commons.objectToGuid" ) ; 
147-             if  ( ! thing ) 
161+ 
162+             if  ( ! thing )  { 
148163                return  null ; 
149-             if  ( thing . guid ) 
164+             }   else   if  ( thing . guid )   { 
150165                return  thing . guid ; 
151-             if  ( thing . getGuid ) 
166+             }   else   if  ( thing . getGuid )   { 
152167                return  thing . getGuid ( ) ; 
153-             if  ( / ^ \d + $ / . test ( thing ) ) 
168+             }   else   if  ( / ^ \d + $ / . test ( thing ) )   { 
154169                return  thing ; 
170+             } 
155171            throw  "Does not look like a MxObject: "  +  thing ; 
156172        } , 
157173
@@ -167,6 +183,7 @@ define([
167183         */ 
168184        store  : function ( object ,  attr ,  value ,  mode ,  commit ,  callback )  { 
169185            logger . debug ( "TreeView.widget.Commons.store" ) ; 
186+ 
170187            var  res  =  false ; 
171188
172189            //list of objects 
@@ -223,10 +240,7 @@ define([
223240                            default :
224241                                res  =  object . set ( attr ,  guids ) ; 
225242                        } 
226-                     } 
227- 
228-                     //single reference 
229-                     else  { 
243+                     }  else  {  //single reference 
230244                        if  ( dojo . isArray ( value ) )  { 
231245                            throw  "Commons.store: cannot assign array to reference" ; 
232246                        } 
@@ -236,8 +250,9 @@ define([
236250                    } 
237251                } 
238252
239-                 else 
253+                 else   { 
240254                    throw  "Commons.store: unsupported attribute path: "  +  attr ; 
255+                 } 
241256
242257                //check res 
243258                if  ( res  ===  false )  {  //set returns undefined if ok, or false on failure 
@@ -264,6 +279,7 @@ define([
264279         */ 
265280        liveConnect  : function ( widget ,  node ,  event ,  map )  { 
266281            logger . debug ( "TreeView.widget.Commons.liveConnect" ) ; 
282+ 
267283            if  ( ! node )  { 
268284                throw  "liveConnect: no node provided" ; 
269285            } 
@@ -290,20 +306,17 @@ define([
290306                    } 
291307                    currNode  =  currNode . parentNode ; 
292308                } 
293- 
294-                 //e && dojo.stopEvent(e); 
295- 
296309            } ) ; 
297310        } , 
298311
299312        /** 
300313         * Shows a confirm dialog. If the message is empty, the dialog is skipped altogether, and the callback is invoked inmediately 
301314         * @param   {[type] }   message  [description] 
302315         * @param   {Function } callback [description] 
303-          * @return  {[type] }            [description] 
304316         */ 
305317        confirm  : function ( message ,  callback ,  yescaption ,  nocaption )  { 
306318            logger . debug ( "TreeView.widget.Commons.confirm" ) ; 
319+ 
307320            if  ( ! message )  { 
308321                mendix . lang . nullExec ( callback ) ; 
309322                return ; 
@@ -319,6 +332,7 @@ define([
319332
320333        mf  : function ( mfname ,  data ,  callback ,  context ,  mfNeedsList ,  progressMessage )  { 
321334            logger . debug ( "TreeView.widget.Commons.mf" ) ; 
335+ 
322336            //firing on multiple items? wait for all items to finish 
323337            if  ( dojo . isArray ( data )  &&  ! mfNeedsList )  { 
324338                var  left  =  data . length ; 
@@ -332,7 +346,6 @@ define([
332346                dojo . forEach ( data ,  function  ( dataitem )  { 
333347                    self . mf ( mfname ,  dataitem ,  cb ,  context ,  false ,  progressMessage ) ; 
334348                } ) ; 
335- 
336349            }  else  { 
337350                var  guids  =  dojo . map ( dojo . isArray ( data )  ? data  : [ data ] ,  this . objectToGuid ) ; 
338351
@@ -357,8 +370,9 @@ define([
357370                        // } 
358371                    } , 
359372                    callback : function  ( _ ,  data )  { 
360-                         if  ( callback ) 
373+                         if  ( callback )   { 
361374                            callback . call ( context  ||  window ) ; 
375+                         } 
362376                    } , 
363377                    async : ! ! progressMessage 
364378                } ) ; 
@@ -367,6 +381,7 @@ define([
367381
368382        configError  : function ( widget ,  msg )  { 
369383            logger . debug ( "TreeView.widget.Commons.configError" ) ; 
384+ 
370385            msg  =  "Configuration error in "  +  widget . id  +  ": "  +  msg ; 
371386            if  ( console )  { 
372387                console . error ( msg ) ; 
@@ -377,6 +392,7 @@ define([
377392
378393        error  : function ( e )  { 
379394            logger . debug ( "TreeView.widget.Commons.error" ) ; 
395+ 
380396            console . error ( e ) ; 
381397            throw  e ; 
382398        } , 
@@ -423,6 +439,7 @@ define([
423439         */ 
424440        normalizeContext  : function ( data ,  cb )  { 
425441            logger . debug ( "TreeView.widget.Commons.normalizeContext" ) ; 
442+             
426443            //Nothing 
427444            if  ( data  ==  null )  { 
428445                cb ( null ,  null ) ; 
0 commit comments