@@ -331,6 +331,9 @@ ClassView.prototype.getPropertyHoverText = function (prop, type) {
331331 : "<span class=\"syntax-keyword\">SoapAction</span>="
332332 + "<span class=\"syntax-string\">" + data + "</span>" ;
333333 } ,
334+ "Default" : function ( data ) {
335+ return "Default = " + lib . highlightCOS ( data + "" ) ;
336+ } ,
334337 "SqlProc" : 1 ,
335338 "WebMethod" : 1 ,
336339 "ZenMethod" : 1 ,
@@ -412,7 +415,7 @@ ClassView.prototype.getPropertyHoverText = function (prop, type) {
412415
413416 var txt = [ ] , val ;
414417 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" ) ) {
416419 val = propText [ i ] === 1
417420 ? "<span class=\"syntax-keyword\">" + i + "</span>"
418421 : propText [ i ] ( prop [ i ] , prop ) ;
@@ -466,6 +469,7 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
466469 for ( n in params ) {
467470 keyWordsArray . push ( n ) ;
468471 arr . push ( {
472+ name : n ,
469473 text : n + ( params [ n ] [ "Type" ] ? ": " + params [ n ] [ "Type" ] : "" ) ,
470474 hover : self . getPropertyHoverText ( params [ n ] , "parameter" ) ,
471475 icons : self . getPropertyIcons ( params [ n ] )
@@ -478,6 +482,7 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
478482 for ( n in ps ) {
479483 keyWordsArray . push ( n ) ;
480484 arr . push ( {
485+ name : n ,
481486 text : n + ( ps [ n ] [ "Type" ] ? ": " + ps [ n ] [ "Type" ] : "" ) ,
482487 hover : self . getPropertyHoverText ( ps [ n ] , "property" ) ,
483488 icons : self . getPropertyIcons ( ps [ n ] )
@@ -490,6 +495,7 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
490495 for ( n in met ) {
491496 keyWordsArray . push ( n ) ;
492497 arr . push ( {
498+ name : n ,
493499 text : n + ( met [ n ] [ "ReturnType" ] ? ": " + met [ n ] [ "ReturnType" ] : "" ) ,
494500 styles : ( function ( t ) {
495501 return t ? { textDecoration : "underline" } : { }
@@ -508,7 +514,8 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
508514 for ( n in qrs ) {
509515 keyWordsArray . push ( n ) ;
510516 arr . push ( {
511- text : n ,
517+ name : n ,
518+ text : n + ( qrs [ n ] [ "Type" ] ? ": " + qrs [ n ] [ "Type" ] : "" ) ,
512519 icons : self . getPropertyIcons ( qrs [ n ] ) ,
513520 hover : self . getPropertyHoverText ( qrs [ n ] , "query" ) ,
514521 clickHandler : ( function ( q , className ) {
@@ -519,7 +526,7 @@ ClassView.prototype.createClassInstance = function (name, classMetaData) {
519526 return arr ;
520527 } ) ( classQueries ) ,
521528 classSigns : this . getClassSigns ( classMetaData ) ,
522- classType : classMetaData . $classType ,
529+ classType : classMetaData . ClassType || "registered" ,
523530 SYMBOL_12_WIDTH : self . SYMBOL_12_WIDTH
524531 } ) ;
525532
@@ -678,7 +685,8 @@ ClassView.prototype.confirmRender = function (data) {
678685 var link = function ( type ) {
679686 var name = type === "inheritance" ? "Generalization" :
680687 type === "aggregation" ? "Aggregation" : type === "composition" ? "Composition"
681- : "Association" ;
688+ : "Association" ,
689+ linkData ;
682690 for ( p in data [ type ] ) {
683691 relFrom = ( classes [ p ] || { } ) . instance ;
684692 for ( pp in data [ type ] [ p ] ) {
@@ -714,8 +722,16 @@ ClassView.prototype.confirmRender = function (data) {
714722 if ( link . left ) arr . push ( getLabel ( link . left , LINK_TEXT_MARGIN ) ) ;
715723 if ( link . right ) arr . push ( getLabel ( link . right , - LINK_TEXT_MARGIN ) ) ;
716724 return arr ;
717- } ) ( data [ type ] [ p ] [ pp ] || { } )
725+ } ) ( linkData = data [ type ] [ p ] [ pp ] || { } )
718726 } ) ) ;
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+ }
719735 self . links . push ( connector ) ;
720736 }
721737 }
@@ -893,6 +909,53 @@ ClassView.prototype.searchOnDiagram = function (text) {
893909
894910} ;
895911
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+
896959ClassView . prototype . init = function ( ) {
897960
898961 var p , self = this ,
@@ -912,6 +975,8 @@ ClassView.prototype.init = function () {
912975 }
913976 } ) ;
914977
978+ this . bindLinkHighlight ( ) ;
979+
915980 // enables links re-routing when dragging objects
916981 this . graph . on ( "change:position" , function ( object ) {
917982 if ( _ . contains ( self . objects , object ) )
0 commit comments