Skip to content

Commit 1224b05

Browse files
committed
Bypass chart on PA nodes. Fixes #395
1 parent c7a4c3b commit 1224b05

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/postanalysis/CreatePANetworkTask.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
import org.cytoscape.view.model.CyNetworkView;
3535
import org.cytoscape.view.model.CyNetworkViewManager;
3636
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;
3740
import org.cytoscape.view.presentation.property.BasicVisualLexicon;
3841
import org.cytoscape.work.AbstractTask;
3942
import org.cytoscape.work.ObservableTask;
@@ -49,6 +52,7 @@ public class CreatePANetworkTask extends AbstractTask implements ObservableTask
4952

5053
@Inject private CyNetworkManager networkManager;
5154
@Inject private CyNetworkViewManager networkViewManager;
55+
@Inject private RenderingEngineManager renderingEngineManager;
5256
@Inject private CyEventHelper eventHelper;
5357
@Inject private Provider<WidthFunction> widthFunctionProvider;
5458

@@ -117,7 +121,9 @@ public void run(TaskMonitor tm) {
117121

118122
// Layout nodes
119123
tm.setStatusMessage("Laying out Nodes");
124+
eventHelper.flushPayloadEvents(); // make sure node views have been created
120125
layoutHubNodes(networkView);
126+
styleHubNodes(networkView);
121127
tm.setProgress(0.4);
122128

123129
// Create Signature Hub Edges
@@ -243,10 +249,9 @@ private void createHubNode(String hubName, CyNetwork network, CyNetworkView netV
243249
}
244250

245251
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
247253
double yOffset = 0;
248-
249-
for (CyNode node : nodeCache.values()) {
254+
for(CyNode node : nodeCache.values()) {
250255
// add currentNodeY_offset to initial Y position of the Node and increase currentNodeY_offset for the next Node
251256
View<CyNode> nodeView = networkView.getNodeView(node);
252257
double nodeY = nodeView.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION);
@@ -255,6 +260,20 @@ private void layoutHubNodes(CyNetworkView networkView) {
255260
}
256261
}
257262

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+
258277
/**
259278
* Returns true iff the user should be warned about an existing edge that
260279
* does not pass the new cutoff. If the edge already exists it will be

0 commit comments

Comments
 (0)