use of org.cytoscape.view.presentation.customgraphics.CyCustomGraphics2 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.presentation.customgraphics.CyCustomGraphics2 in project cytoscape-impl by cytoscape.
the class CyCustomGraphicsValueEditor method refreshUI.
private void refreshUI() {
getGraphicsPnl().updateList();
Component newSelected = getGraphicsPnl();
final Iterator<Entry<String, CustomGraphics2Panel>> iter = cg2PnlMap.entrySet().iterator();
while (iter.hasNext()) {
final CustomGraphics2Panel cg2Pnl = iter.next().getValue();
cg2Pnl.update(oldCustomGraphics instanceof CyCustomGraphics2 ? (CyCustomGraphics2) oldCustomGraphics : null);
if (cg2Pnl.getEditorCount() == 0) {
iter.remove();
if (getGroupTpn().indexOfComponent(cg2Pnl) >= 0)
getGroupTpn().remove(cg2Pnl);
continue;
}
if (oldCustomGraphics instanceof CyCustomGraphics2 && cg2Pnl.canEdit((CyCustomGraphics2) oldCustomGraphics))
newSelected = cg2Pnl;
}
getGroupTpn().setSelectedComponent(newSelected);
}
Aggregations