use of org.cytoscape.application.CyApplicationManager in project cytoscape-impl by cytoscape.
the class BirdsEyeViewPanel method update.
public final void update() {
final Dimension currentPanelSize = getSize();
getPresentationPanel().setSize(currentPanelSize);
getPresentationPanel().setPreferredSize(currentPanelSize);
if (engine == null) {
final CyApplicationManager applicationManager = serviceRegistrar.getService(CyApplicationManager.class);
final NetworkViewRenderer renderer = applicationManager.getNetworkViewRenderer(networkView.getRendererId());
final RenderingEngineFactory<CyNetwork> bevFactory = renderer.getRenderingEngineFactory(NetworkViewRenderer.BIRDS_EYE_CONTEXT);
engine = bevFactory.createRenderingEngine(getPresentationPanel(), networkView);
}
repaint();
}
use of org.cytoscape.application.CyApplicationManager in project cytoscape-impl by cytoscape.
the class GradientEditorPanel method updateView.
void updateView() {
final CyApplicationManager appMgr = servicesUtil.get(CyApplicationManager.class);
style.apply(appMgr.getCurrentNetworkView());
appMgr.getCurrentNetworkView().updateView();
getSlider().repaint();
}
use of org.cytoscape.application.CyApplicationManager in project cytoscape-impl by cytoscape.
the class GradientEditorPanel method deleteButtonActionPerformed.
@Override
protected void deleteButtonActionPerformed(final ActionEvent evt) {
final int selectedIndex = getSlider().getSelectedIndex();
if (0 <= selectedIndex) {
getSlider().getModel().removeThumb(selectedIndex);
mapping.removePoint(selectedIndex);
updateMap();
final CyApplicationManager appMgr = servicesUtil.get(CyApplicationManager.class);
appMgr.getCurrentNetworkView().updateView();
repaint();
}
}
use of org.cytoscape.application.CyApplicationManager in project cytoscape-impl by cytoscape.
the class C2DEditor method setValue.
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setValue(final Object value) {
if (value instanceof ContinuousMapping == false)
throw new IllegalArgumentException("Value should be ContinuousMapping: this is " + value);
final CyApplicationManager appMgr = servicesUtil.get(CyApplicationManager.class);
final CyNetwork currentNetwork = appMgr.getCurrentNetwork();
if (currentNetwork == null)
return;
ContinuousMapping<?, ?> mTest = (ContinuousMapping<?, ?>) value;
// TODO: error chekcing
mapping = (ContinuousMapping<Number, V>) value;
Class<? extends CyIdentifiable> type = (Class<? extends CyIdentifiable>) mapping.getVisualProperty().getTargetDataType();
final CyNetworkTableManager netTblMgr = servicesUtil.get(CyNetworkTableManager.class);
final CyTable attr = netTblMgr.getTable(appMgr.getCurrentNetwork(), type, CyNetwork.DEFAULT_ATTRS);
final VisualMappingManager vmMgr = servicesUtil.get(VisualMappingManager.class);
editorPanel = new C2DMappingEditorPanel(vmMgr.getCurrentVisualStyle(), mapping, attr, editorManager, servicesUtil);
}
use of org.cytoscape.application.CyApplicationManager in project cytoscape-impl by cytoscape.
the class LegendDialog method createMappingLegends.
@SuppressWarnings("rawtypes")
private void createMappingLegends(final Collection<VisualMappingFunction<?, ?>> mappings, final JPanel legend) {
for (VisualMappingFunction<?, ?> map : mappings) {
final CyApplicationManager appMgr = servicesUtil.get(CyApplicationManager.class);
final JPanel mappingLegend;
if (map instanceof ContinuousMapping) {
mappingLegend = new ContinuousLegendPanel(visualStyle, (ContinuousMapping) map, appMgr.getCurrentNetwork().getDefaultNodeTable(), servicesUtil);
} else if (map instanceof DiscreteMapping) {
mappingLegend = new DiscreteLegendPanel((DiscreteMapping<?, ?>) map, servicesUtil);
} else if (map instanceof DiscreteMapping) {
mappingLegend = new PassthroughLegendPanel((PassthroughMapping<?, ?>) map, servicesUtil);
} else {
continue;
}
// display anything besides the title.
if (map instanceof PassthroughMapping)
legend.add(mappingLegend, 0);
else
legend.add(mappingLegend);
// Set padding
mappingLegend.setBorder(new EmptyBorder(15, 30, 15, 30));
}
}
Aggregations