34
34
import org .cytoscape .view .model .CyNetworkView ;
35
35
import org .cytoscape .view .model .CyNetworkViewManager ;
36
36
import org .cytoscape .view .model .View ;
37
+ import org .cytoscape .view .model .VisualLexicon ;
38
+ import org .cytoscape .view .model .VisualProperty ;
39
+ import org .cytoscape .view .presentation .RenderingEngineManager ;
37
40
import org .cytoscape .view .presentation .property .BasicVisualLexicon ;
38
41
import org .cytoscape .work .AbstractTask ;
39
42
import org .cytoscape .work .ObservableTask ;
@@ -49,6 +52,7 @@ public class CreatePANetworkTask extends AbstractTask implements ObservableTask
49
52
50
53
@ Inject private CyNetworkManager networkManager ;
51
54
@ Inject private CyNetworkViewManager networkViewManager ;
55
+ @ Inject private RenderingEngineManager renderingEngineManager ;
52
56
@ Inject private CyEventHelper eventHelper ;
53
57
@ Inject private Provider <WidthFunction > widthFunctionProvider ;
54
58
@@ -117,7 +121,9 @@ public void run(TaskMonitor tm) {
117
121
118
122
// Layout nodes
119
123
tm .setStatusMessage ("Laying out Nodes" );
124
+ eventHelper .flushPayloadEvents (); // make sure node views have been created
120
125
layoutHubNodes (networkView );
126
+ styleHubNodes (networkView );
121
127
tm .setProgress (0.4 );
122
128
123
129
// Create Signature Hub Edges
@@ -243,10 +249,9 @@ private void createHubNode(String hubName, CyNetwork network, CyNetworkView netV
243
249
}
244
250
245
251
private void layoutHubNodes (CyNetworkView networkView ) {
246
- eventHelper . flushPayloadEvents (); // make sure node views have been created
252
+ // make sure to call eventHelper.flushPayloadEvents() before calling this
247
253
double yOffset = 0 ;
248
-
249
- for (CyNode node : nodeCache .values ()) {
254
+ for (CyNode node : nodeCache .values ()) {
250
255
// add currentNodeY_offset to initial Y position of the Node and increase currentNodeY_offset for the next Node
251
256
View <CyNode > nodeView = networkView .getNodeView (node );
252
257
double nodeY = nodeView .getVisualProperty (BasicVisualLexicon .NODE_Y_LOCATION );
@@ -255,6 +260,20 @@ private void layoutHubNodes(CyNetworkView networkView) {
255
260
}
256
261
}
257
262
263
+
264
+ @ SuppressWarnings ( {"rawtypes" , "unchecked" } )
265
+ private void styleHubNodes (CyNetworkView networkView ) {
266
+ // make sure PA nodes don't have a chart obscuring them
267
+ VisualLexicon lexicon = renderingEngineManager .getDefaultVisualLexicon ();
268
+ VisualProperty customPaint1 = lexicon .lookup (CyNode .class , "NODE_CUSTOMGRAPHICS_1" );
269
+ Object nullCustomGraphics = customPaint1 .getDefault ();
270
+
271
+ for (CyNode node : nodeCache .values ()) {
272
+ View <CyNode > nodeView = networkView .getNodeView (node );
273
+ nodeView .setLockedValue (customPaint1 , nullCustomGraphics );
274
+ }
275
+ }
276
+
258
277
/**
259
278
* Returns true iff the user should be warned about an existing edge that
260
279
* does not pass the new cutoff. If the edge already exists it will be
0 commit comments