@@ -133,7 +133,7 @@ ClassView.prototype.renderInfoGraphic = function () {
133
133
abstract : 1
134
134
} ,
135
135
"Class method" : {
136
- classMethod : 1
136
+ ClassMethod : 1
137
137
} ,
138
138
"Client method" : {
139
139
clientMethod : 1
@@ -349,28 +349,143 @@ ClassView.prototype.getClassSigns = function (classMetaData) {
349
349
/**
350
350
* Returns array of icons according to method metadata.
351
351
*
352
- * @param method
352
+ * @param property
353
353
*/
354
- ClassView . prototype . getPropertyIcons = function ( method ) {
354
+ ClassView . prototype . getPropertyIcons = function ( property ) {
355
355
356
356
var icons = [ ] ;
357
357
358
- if ( typeof method [ "Private" ] !== "undefined" ) {
359
- icons . push ( { src : lib . image [ method [ "Private" ] ? "minus" : "plus" ] } ) ;
358
+ if ( typeof property [ "Private" ] !== "undefined" ) {
359
+ icons . push ( { src : lib . image [ property [ "Private" ] ? "minus" : "plus" ] } ) ;
360
+ }
361
+ if ( property [ "Abstract" ] ) icons . push ( { src : lib . image . crystalBall } ) ;
362
+ if ( property [ "ClientMethod" ] ) icons . push ( { src : lib . image . user } ) ;
363
+ if ( property [ "Final" ] ) icons . push ( { src : lib . image . blueFlag } ) ;
364
+ if ( property [ "NotInheritable" ] ) icons . push ( { src : lib . image . redFlag } ) ;
365
+ if ( property [ "SqlProc" ] ) icons . push ( { src : lib . image . table } ) ;
366
+ if ( property [ "WebMethod" ] ) icons . push ( { src : lib . image . earth } ) ;
367
+ if ( property [ "ZenMethod" ] ) icons . push ( { src : lib . image . zed } ) ;
368
+ if ( property [ "ReadOnly" ] ) icons . push ( { src : lib . image . eye } ) ;
369
+ if ( property [ "index" ] ) {
370
+ icons . push (
371
+ property [ "index" ] [ "Unique" ] ? { src : lib . image . keyRed }
372
+ : ( property [ "index" ] [ "PrimaryKey" ] || property [ "index" ] [ "IDKey" ] )
373
+ ? { src : lib . image . keyGreen } : { src : lib . image . keyYellow }
374
+ ) ;
360
375
}
361
- if ( method [ "Abstract" ] ) icons . push ( { src : lib . image . crystalBall } ) ;
362
- if ( method [ "ClientMethod" ] ) icons . push ( { src : lib . image . user } ) ;
363
- if ( method [ "Final" ] ) icons . push ( { src : lib . image . blueFlag } ) ;
364
- if ( method [ "NotInheritable" ] ) icons . push ( { src : lib . image . redFlag } ) ;
365
- if ( method [ "SqlProc" ] ) icons . push ( { src : lib . image . table } ) ;
366
- if ( method [ "WebMethod" ] ) icons . push ( { src : lib . image . earth } ) ;
367
- if ( method [ "ZenMethod" ] ) icons . push ( { src : lib . image . zed } ) ;
368
- if ( method [ "ReadOnly" ] ) icons . push ( { src : lib . image . eye } ) ;
369
376
370
377
return icons ;
371
378
372
379
} ;
373
380
381
+ /**
382
+ * @param prop
383
+ * @param {string } type = ["parameter", "property", "method", "query"]
384
+ * @returns {string }
385
+ */
386
+ ClassView . prototype . getPropertyHoverText = function ( prop , type ) {
387
+
388
+ var ind , i , desc = "" ,
389
+ indexText = {
390
+ "IdKey" : function ( ) { return "IdKey" ; } ,
391
+ "Type" : function ( type ) { return "Type=" + type ; } ,
392
+ "Internal" : function ( ) { return "Internal" ; } ,
393
+ "Extent" : function ( ) { return "Extent" ; } ,
394
+ "PrimaryKey" : function ( ) { return "PrimaryKey" ; } ,
395
+ "Unique" : function ( ) { return "Unique" ; }
396
+ } ,
397
+ propText = {
398
+ "Calculated" : 1 ,
399
+ "Final" : 1 ,
400
+ "Identity" : 1 ,
401
+ "InitialExpression" : function ( data ) {
402
+ return ( data === "\"\"" )
403
+ ? ""
404
+ : "<span class=\"syntax-keyword\">InitialExpression</span>="
405
+ + lib . highlightCOS ( data + "" )
406
+ } ,
407
+ "Internal" : 1 ,
408
+ "MultiDimensional" : 1 ,
409
+ "NoModBit" : 1 ,
410
+ "NotInheritable" : 1 ,
411
+ "Private" : 1 ,
412
+ "ReadOnly" : 1 ,
413
+ "Relationship" : function ( data , p ) {
414
+ return "<span class=\"syntax-keyword\">Relationship</span> [ Cardinality="
415
+ + p [ "Cardinality" ] + ", Inverse=" + p [ "Inverse" ] + " ]" ;
416
+ } ,
417
+ "Required" : 1 ,
418
+ "SqlComputed" : function ( data , p ) {
419
+ return p [ "SqlComputeCode" ]
420
+ ? "<span class=\"syntax-keyword\">SqlComputed</span> [ SqlComputeCode={"
421
+ + lib . highlightCOS ( p [ "SqlComputeCode" ] ) + "} ]"
422
+ : "" ;
423
+ } ,
424
+ "Transient" : 1 ,
425
+ // -- methods
426
+ "Abstract" : 1 ,
427
+ // "ClassMethod": 1, - they're underlined
428
+ "ClientMethod" : 1 ,
429
+ "CodeMode" : function ( data ) {
430
+ return data === "code" ? "" : "<span class=\"syntax-keyword\">CodeMode</span>="
431
+ + "<span class=\"syntax-string\">" + data + "</span>" ;
432
+ } ,
433
+ "ForceGenerate" : 1 ,
434
+ "NoContext" : 1 ,
435
+ "NotForProperty" : 1 ,
436
+ "ReturnResultsets" : 1 ,
437
+ "SoapAction" : function ( data ) {
438
+ return data === "[default]" ? ""
439
+ : "<span class=\"syntax-keyword\">SoapAction</span>="
440
+ + "<span class=\"syntax-string\">" + data + "</span>" ;
441
+ } ,
442
+ "SqlProc" : 1 ,
443
+ "WebMethod" : 1 ,
444
+ "ZenMethod" : 1 ,
445
+ // -- parameters
446
+ "Encoded" : 1 ,
447
+ // -- queries
448
+ "SqlView" : 1
449
+ } ;
450
+
451
+ if ( ind = prop [ "index" ] ) {
452
+ desc += "<span class=\"syntax-keyword\">INDEX</span> <span class=\"syntax-string\">"
453
+ + ind [ "Name" ] + "</span> " + ( function ( ) {
454
+ var txt = [ ] ;
455
+ for ( i in ind ) {
456
+ if ( indexText [ i ] && ind [ i ] ) txt . push ( indexText [ i ] ( ind [ i ] ) ) ;
457
+ }
458
+ return txt . join ( ", " ) ;
459
+ } ) ( )
460
+ + "\n" ;
461
+ }
462
+
463
+ var txt = [ ] , val ;
464
+ for ( i in prop ) {
465
+ if ( propText [ i ] && ( prop [ i ] || i === "InitialExpression" ) ) {
466
+ val = propText [ i ] === 1
467
+ ? "<span class=\"syntax-keyword\">" + i + "</span>"
468
+ : propText [ i ] ( prop [ i ] , prop ) ;
469
+ if ( val !== "" ) txt . push ( val ) ;
470
+ }
471
+ }
472
+ if ( txt . length ) desc += txt . join ( ", " ) ;
473
+
474
+ // Display FormalSpec in methods?
475
+
476
+ if ( desc && prop [ "Description" ] ) desc += "<hr/>" ;
477
+ desc += prop [ "Description" ] || "" ;
478
+
479
+ if ( desc && type ) {
480
+ desc = "<span class=\"underlined\"><span class=\"syntax-keyword\">" + lib . capitalize ( type )
481
+ + "</span> <span class=\"syntax-string\">" + ( prop [ "Name" ] || "" ) + "</span></span>:"
482
+ + ( "<br/>" ) + desc ;
483
+ }
484
+
485
+ return desc ;
486
+
487
+ } ;
488
+
374
489
/**
375
490
* @param {string } name
376
491
* @param classMetaData
@@ -401,7 +516,7 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
401
516
keyWordsArray . push ( n ) ;
402
517
arr . push ( {
403
518
text : n + ( params [ n ] [ "Type" ] ? ": " + params [ n ] [ "Type" ] : "" ) ,
404
- hover : params [ n ] [ "Description" ] || "" ,
519
+ hover : self . getPropertyHoverText ( params [ n ] , "parameter" ) ,
405
520
icons : self . getPropertyIcons ( params [ n ] )
406
521
} ) ;
407
522
}
@@ -413,7 +528,7 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
413
528
keyWordsArray . push ( n ) ;
414
529
arr . push ( {
415
530
text : n + ( ps [ n ] [ "Type" ] ? ": " + ps [ n ] [ "Type" ] : "" ) ,
416
- hover : ps [ n ] [ "Description" ] || "" ,
531
+ hover : self . getPropertyHoverText ( ps [ n ] , "property" ) ,
417
532
icons : self . getPropertyIcons ( ps [ n ] )
418
533
} ) ;
419
534
}
@@ -427,11 +542,11 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
427
542
text : n + ( met [ n ] [ "ReturnType" ] ? ": " + met [ n ] [ "ReturnType" ] : "" ) ,
428
543
styles : ( function ( t ) {
429
544
return t ? { textDecoration : "underline" } : { }
430
- } ) ( met [ n ] [ "classMethod " ] ) ,
545
+ } ) ( met [ n ] [ "ClassMethod " ] ) ,
431
546
clickHandler : ( function ( n ) {
432
547
return function ( ) { self . showMethodCode ( name , n ) ; }
433
548
} ) ( n ) ,
434
- hover : met [ n ] [ "Description" ] || "" ,
549
+ hover : self . getPropertyHoverText ( met [ n ] , "method" ) ,
435
550
icons : self . getPropertyIcons ( met [ n ] )
436
551
} ) ;
437
552
}
@@ -444,7 +559,7 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
444
559
arr . push ( {
445
560
text : n ,
446
561
icons : self . getPropertyIcons ( qrs [ n ] ) ,
447
- hover : qrs [ n ] [ "SqlQuery" ] ,
562
+ hover : self . getPropertyHoverText ( qrs [ n ] , "query" ) ,
448
563
clickHandler : ( function ( q , className ) {
449
564
return function ( ) { self . showQuery ( className , q ) ; }
450
565
} ) ( qrs [ n ] , name )
0 commit comments