@@ -434,23 +434,34 @@ private static NodeList removeOutlier(NodeList nl, Graph2D graph, int threshold)
434
434
*/
435
435
public static NodeRealizer setupGroupNode (NodeLabel nl , String changeCaption ) {
436
436
GroupNodeRealizer nr = new GroupNodeRealizer ();
437
- ((GroupNodeRealizer )nr ).setGroupClosed (false );
438
- nr .setTransparent (true );
437
+ setupGroupNode (nr );
439
438
440
- if (changeCaption !=null ) {
441
- nl .setText (changeCaption );
439
+ if (nl !=null ) {
440
+ if (changeCaption !=null ) {
441
+ nl .setText (changeCaption );
442
+ }
443
+
444
+ nl .setPosition (NodeLabel .TOP );
445
+ nl .setBackgroundColor (new Color ((float )0.8 ,(float )0.8 ,(float )0.8 ,(float )0.5 ));
446
+ nl .setFontSize (10 );
447
+ nl .setAutoSizePolicy (NodeLabel .AUTOSIZE_NODE_WIDTH );
448
+
449
+ nr .setLabel (nl );
442
450
}
443
451
452
+ return nr ;
453
+ }
454
+
455
+ public static void setupGroupNode (GroupNodeRealizer nr ) {
456
+ ((GroupNodeRealizer )nr ).setGroupClosed (false );
457
+ // Setting the transparency influences the edges, such that they
458
+ // will end in the middle of the group node, instead of the border!
459
+ //nr.setTransparent(true);
460
+ nr .setFillColor (null );
461
+ nr .setFillColor2 (null );
462
+
444
463
nr .setMinimalInsets (new YInsets (5 , 2 , 2 , 2 )); // top, left, bottom, right
445
464
nr .setAutoBoundsEnabled (true );
446
- nl .setPosition (NodeLabel .TOP );
447
- nl .setBackgroundColor (new Color ((float )0.8 ,(float )0.8 ,(float )0.8 ,(float )0.5 ));
448
- nl .setFontSize (10 );
449
- nl .setAutoSizePolicy (NodeLabel .AUTOSIZE_NODE_WIDTH );
450
-
451
- nr .setLabel (nl );
452
-
453
- return nr ;
454
465
}
455
466
456
467
/**
@@ -610,11 +621,18 @@ protected Graph2D translateWithoutPreprocessing(Pathway p) {
610
621
nl .setUserData (nodeLink );
611
622
}
612
623
613
- n = graph . createNode ( nr );
624
+ // Crete the node => Either a group or normal node.
614
625
if (addThisNodeToGroupNodeList ) {
615
- hm .convertToGroupNode (n );
626
+ n = hm .createGroupNode (graph );
627
+ //setupGroupNode((GroupNodeRealizer) graph.getRealizer(n));
628
+ graph .setRealizer (n , nr );
629
+
630
+ //hm.convertToGroupNode(n);
616
631
parentGroupNodes .add (n );
632
+ } else {
633
+ n = graph .createNode (nr );
617
634
}
635
+
618
636
if (g .isDefaultPosition ()) {
619
637
toLayout .add (n );
620
638
}
@@ -649,7 +667,7 @@ protected Graph2D translateWithoutPreprocessing(Pathway p) {
649
667
nl .setUserData (nodeLink );
650
668
}
651
669
652
- // Create a node, but don't set the reference
670
+ // Create a node for each graphics attribute , but don't set the reference
653
671
graph .createNode (nr );
654
672
}
655
673
}
@@ -970,6 +988,7 @@ else if (e.getType().equals(EntryType.gene))
970
988
971
989
//gnr.setBorderInsets(new YInsets(1, 1, 1, 1));
972
990
991
+ // Create grouped node for all same edges
973
992
Node n = graph .createNode (gnr );
974
993
hm .convertToGroupNode (n );
975
994
hm .setParentNode (nl , n );
@@ -1123,6 +1142,7 @@ private NodeRealizer setupGraphics(NodeRealizer nr, NodeLabel nl, Graphics g) {
1123
1142
if (nr ==null ) {
1124
1143
if (g .getType ().equals (GraphicsType .rectangle )) {
1125
1144
nr = new ShapeNodeRealizer (ShapeNodeRealizer .RECT );
1145
+ //nr = new ShapeNodeRealizerRespectingLabels(ShapeNodeRealizer.RECT);
1126
1146
} else if (g .getType ().equals (GraphicsType .circle )) {
1127
1147
nr = new ShapeNodeRealizer (ShapeNodeRealizer .ELLIPSE );
1128
1148
nl .setFontSize (10 ); // looks better on small ellipses
0 commit comments