@@ -331,6 +331,9 @@ ClassView.prototype.getPropertyHoverText = function (prop, type) {
331
331
: "<span class=\"syntax-keyword\">SoapAction</span>="
332
332
+ "<span class=\"syntax-string\">" + data + "</span>" ;
333
333
} ,
334
+ "Default" : function ( data ) {
335
+ return "Default = " + lib . highlightCOS ( data + "" ) ;
336
+ } ,
334
337
"SqlProc" : 1 ,
335
338
"WebMethod" : 1 ,
336
339
"ZenMethod" : 1 ,
@@ -412,7 +415,7 @@ ClassView.prototype.getPropertyHoverText = function (prop, type) {
412
415
413
416
var txt = [ ] , val ;
414
417
for ( i in prop ) {
415
- if ( propText [ i ] && ( prop [ i ] || i === "InitialExpression" || i === "ProcedureBlock" ) ) {
418
+ if ( propText [ i ] && ( prop [ i ] || i === "InitialExpression" || i === "ProcedureBlock" || i === "Default" ) ) {
416
419
val = propText [ i ] === 1
417
420
? "<span class=\"syntax-keyword\">" + i + "</span>"
418
421
: propText [ i ] ( prop [ i ] , prop ) ;
@@ -466,6 +469,7 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
466
469
for ( n in params ) {
467
470
keyWordsArray . push ( n ) ;
468
471
arr . push ( {
472
+ name : n ,
469
473
text : n + ( params [ n ] [ "Type" ] ? ": " + params [ n ] [ "Type" ] : "" ) ,
470
474
hover : self . getPropertyHoverText ( params [ n ] , "parameter" ) ,
471
475
icons : self . getPropertyIcons ( params [ n ] )
@@ -478,6 +482,7 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
478
482
for ( n in ps ) {
479
483
keyWordsArray . push ( n ) ;
480
484
arr . push ( {
485
+ name : n ,
481
486
text : n + ( ps [ n ] [ "Type" ] ? ": " + ps [ n ] [ "Type" ] : "" ) ,
482
487
hover : self . getPropertyHoverText ( ps [ n ] , "property" ) ,
483
488
icons : self . getPropertyIcons ( ps [ n ] )
@@ -490,6 +495,7 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
490
495
for ( n in met ) {
491
496
keyWordsArray . push ( n ) ;
492
497
arr . push ( {
498
+ name : n ,
493
499
text : n + ( met [ n ] [ "ReturnType" ] ? ": " + met [ n ] [ "ReturnType" ] : "" ) ,
494
500
styles : ( function ( t ) {
495
501
return t ? { textDecoration : "underline" } : { }
@@ -508,7 +514,8 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
508
514
for ( n in qrs ) {
509
515
keyWordsArray . push ( n ) ;
510
516
arr . push ( {
511
- text : n ,
517
+ name : n ,
518
+ text : n + ( qrs [ n ] [ "Type" ] ? ": " + qrs [ n ] [ "Type" ] : "" ) ,
512
519
icons : self . getPropertyIcons ( qrs [ n ] ) ,
513
520
hover : self . getPropertyHoverText ( qrs [ n ] , "query" ) ,
514
521
clickHandler : ( function ( q , className ) {
@@ -519,7 +526,7 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
519
526
return arr ;
520
527
} ) ( classQueries ) ,
521
528
classSigns : this . getClassSigns ( classMetaData ) ,
522
- classType : classMetaData . $classType ,
529
+ classType : classMetaData . ClassType || "registered" ,
523
530
SYMBOL_12_WIDTH : self . SYMBOL_12_WIDTH
524
531
} ) ;
525
532
@@ -678,7 +685,8 @@ ClassView.prototype.confirmRender = function (data) {
678
685
var link = function ( type ) {
679
686
var name = type === "inheritance" ? "Generalization" :
680
687
type === "aggregation" ? "Aggregation" : type === "composition" ? "Composition"
681
- : "Association" ;
688
+ : "Association" ,
689
+ linkData ;
682
690
for ( p in data [ type ] ) {
683
691
relFrom = ( classes [ p ] || { } ) . instance ;
684
692
for ( pp in data [ type ] [ p ] ) {
@@ -714,8 +722,16 @@ ClassView.prototype.confirmRender = function (data) {
714
722
if ( link . left ) arr . push ( getLabel ( link . left , LINK_TEXT_MARGIN ) ) ;
715
723
if ( link . right ) arr . push ( getLabel ( link . right , - LINK_TEXT_MARGIN ) ) ;
716
724
return arr ;
717
- } ) ( data [ type ] [ p ] [ pp ] || { } )
725
+ } ) ( linkData = data [ type ] [ p ] [ pp ] || { } )
718
726
} ) ) ;
727
+ if ( linkData . from ) {
728
+ connector . _fromClass = linkData . from ;
729
+ connector . _fromClass . instance = relTo ;
730
+ }
731
+ if ( linkData . to ) {
732
+ connector . _toClass = linkData . to ;
733
+ connector . _toClass . instance = relFrom ;
734
+ }
719
735
self . links . push ( connector ) ;
720
736
}
721
737
}
@@ -893,6 +909,53 @@ ClassView.prototype.searchOnDiagram = function (text) {
893
909
894
910
} ;
895
911
912
+ ClassView . prototype . bindLinkHighlight = function ( ) {
913
+
914
+ var self = this ,
915
+ highlighted = false ,
916
+ fields = [ ] ;
917
+
918
+ var freeFields = function ( ) {
919
+ fields . forEach ( function ( f ) {
920
+ if ( f . classList ) f . classList . remove ( "line-selected" ) ;
921
+ } ) ;
922
+ fields = [ ] ;
923
+ } ;
924
+
925
+ this . paper . on ( "cell:mouseover" , function ( e ) {
926
+ var link , view , el ;
927
+ freeFields ( ) ;
928
+ link = e . model || null ;
929
+ if ( ! link ) return ;
930
+ if ( link . _fromClass && link . _fromClass . instance && link . _fromClass . in
931
+ && ( view = self . paper . findViewByModel ( link . _fromClass . instance ) )
932
+ && view . el && view . el . _LINE_ELEMENTS && view . el . _LINE_ELEMENTS [ link . _fromClass . in ]
933
+ && ( el = view . el . _LINE_ELEMENTS [ link . _fromClass . in ] [ link . _fromClass . name ] ) ) {
934
+ fields . push ( el ) ;
935
+ }
936
+ if ( link . _toClass && link . _toClass . instance && link . _toClass . in
937
+ && ( view = self . paper . findViewByModel ( link . _toClass . instance ) )
938
+ && view . el && view . el . _LINE_ELEMENTS && view . el . _LINE_ELEMENTS [ link . _toClass . in ]
939
+ && ( el = view . el . _LINE_ELEMENTS [ link . _toClass . in ] [ link . _toClass . name ] ) ) {
940
+ fields . push ( el ) ;
941
+ }
942
+ fields . forEach ( function ( f ) {
943
+ if ( f . classList ) {
944
+ f . classList . add ( "line-selected" ) ;
945
+ } else {
946
+ console . warn ( "Your browser does not support CSS3 classList property." ) ;
947
+ }
948
+ } ) ;
949
+ highlighted = ! ! fields . length ;
950
+ } ) ;
951
+
952
+ this . paper . on ( "cell:mouseout" , function ( e ) {
953
+ highlighted = false ;
954
+ freeFields ( ) ;
955
+ } ) ;
956
+
957
+ } ;
958
+
896
959
ClassView . prototype . init = function ( ) {
897
960
898
961
var p , self = this ,
@@ -912,6 +975,8 @@ ClassView.prototype.init = function () {
912
975
}
913
976
} ) ;
914
977
978
+ this . bindLinkHighlight ( ) ;
979
+
915
980
// enables links re-routing when dragging objects
916
981
this . graph . on ( "change:position" , function ( object ) {
917
982
if ( _ . contains ( self . objects , object ) )
0 commit comments