use of org.cytoscape.view.model.VisualLexicon in project EnrichmentMapApp by BaderLab.
the class EMStyleBuilder method setNodeChart.
@SuppressWarnings({ "rawtypes", "unchecked" })
private void setNodeChart(VisualStyle vs, CyCustomGraphics2<?> chart) {
VisualLexicon lexicon = renderingEngineManager.getDefaultVisualLexicon();
VisualProperty customPaint1 = lexicon.lookup(CyNode.class, "NODE_CUSTOMGRAPHICS_1");
if (customPaint1 != null)
vs.setDefaultValue(customPaint1, chart);
}
use of org.cytoscape.view.model.VisualLexicon in project cytoscape-api by cytoscape.
the class AbstractRenderingEngineTest method testLexicon.
@Test
public void testLexicon() throws Exception {
final VisualLexicon lexicon = engine.getVisualLexicon();
assertNotNull(lexicon);
assertEquals(numberOfVP, lexicon.getAllVisualProperties().size());
}
use of org.cytoscape.view.model.VisualLexicon in project EnrichmentMapApp by BaderLab.
the class LegendPanel method updateNodeChartPanel.
private void updateNodeChartPanel(Collection<EMDataSet> dataSets, EnrichmentMap map) {
JPanel p = getNodeChartPanel();
chartLegendPanel.removeAll();
CyNetworkView netView = options.getNetworkView();
VisualStyle style = netView != null ? visualMappingManager.getVisualStyle(netView) : null;
NetworkViewRenderer renderer = applicationManager.getCurrentNetworkViewRenderer();
if (renderer == null)
renderer = applicationManager.getDefaultNetworkViewRenderer();
VisualLexicon lexicon = renderer.getRenderingEngineFactory(NetworkViewRenderer.DEFAULT_CONTEXT).getVisualLexicon();
VisualProperty<?> vp = lexicon.lookup(CyNode.class, "NODE_CUSTOMGRAPHICS_1");
Object cg = vp != null ? style.getDefaultValue(vp) : null;
ChartType chartType = options.getChartOptions() != null ? options.getChartOptions().getType() : null;
if (chartType != null && cg instanceof CyCustomGraphics2 && dataSets != null && dataSets.size() > 1) {
ChartPanel chart = createChartPanel(dataSets);
if (chart != null) {
JLabel titleLabel = new JLabel("" + options.getChartOptions().getData());
titleLabel.setHorizontalAlignment(JLabel.CENTER);
makeSmall(titleLabel);
chartLegendPanel.add(chart, BorderLayout.CENTER);
chartLegendPanel.add(titleLabel, BorderLayout.SOUTH);
}
p.setVisible(true);
} else {
p.setVisible(false);
}
p.revalidate();
}
use of org.cytoscape.view.model.VisualLexicon in project EnrichmentMapApp by BaderLab.
the class FilterNodesEdgesTask method filterNodes.
private void filterNodes(Set<CyNode> nodes, TaskMonitor taskMonitor) {
CyNetwork net = networkView.getModel();
for (CyNode n : net.getNodeList()) {
if (cancelled)
return;
final View<CyNode> nv = networkView.getNodeView(n);
if (nv == null)
// Should never happen!
continue;
boolean filteredIn = nodes.contains(n);
VisualLexicon lexicon = renderingEngineManager.getDefaultVisualLexicon();
VisualProperty<?> customGraphics1 = lexicon.lookup(CyNode.class, "NODE_CUSTOMGRAPHICS_1");
// Don't forget to remove all previous locked values first!
nv.clearValueLock(NODE_VISIBLE);
nv.clearValueLock(NODE_TRANSPARENCY);
nv.clearValueLock(NODE_BORDER_TRANSPARENCY);
nv.clearValueLock(NODE_LABEL_TRANSPARENCY);
if (customGraphics1 != null)
nv.clearValueLock(customGraphics1);
if (filteredIn) {
if (filterMode == FilterMode.SELECT)
net.getRow(n).set(CyNetwork.SELECTED, true);
} else {
switch(filterMode) {
case HIDE:
net.getRow(n).set(CyNetwork.SELECTED, false);
nv.setLockedValue(NODE_VISIBLE, false);
break;
case HIGHLIGHT:
nv.setLockedValue(NODE_TRANSPARENCY, FILTERED_OUT_NODE_TRANSPARENCY);
nv.setLockedValue(NODE_BORDER_TRANSPARENCY, FILTERED_OUT_NODE_TRANSPARENCY);
nv.setLockedValue(NODE_LABEL_TRANSPARENCY, 0);
if (customGraphics1 != null)
nv.setLockedValue(customGraphics1, NullCustomGraphics.getNullObject());
break;
case SELECT:
net.getRow(n).set(CyNetwork.SELECTED, false);
break;
}
}
}
}
Aggregations