use of org.cytoscape.view.vizmap.VisualStyle in project cytoscape-impl by cytoscape.
the class VizMapperProxy method handleEvent.
@Override
public void handleEvent(final VisualStyleAboutToBeRemovedEvent e) {
synchronized (lock) {
if (!cytoscapeStarted || ignoreStyleEvents)
return;
}
final VisualStyle vs = e.getVisualStyleToBeRemoved();
boolean changed = false;
synchronized (lock) {
changed = visualStyles.remove(vs);
}
if (changed && !loadingSession)
sendNotification(VISUAL_STYLE_REMOVED, vs);
}
use of org.cytoscape.view.vizmap.VisualStyle in project cytoscape-impl by cytoscape.
the class VizMapperProxy method getNetworkViewsWithStyle.
public Set<CyNetworkView> getNetworkViewsWithStyle(final VisualStyle style) {
final Set<CyNetworkView> views = new HashSet<>();
if (style != null) {
final VisualMappingManager vmMgr = servicesUtil.get(VisualMappingManager.class);
final Set<CyNetworkView> allNetViews = servicesUtil.get(CyNetworkViewManager.class).getNetworkViewSet();
for (final CyNetworkView nv : allNetViews) {
final VisualStyle vs = vmMgr.getVisualStyle(nv);
if (style.equals(vs))
views.add(nv);
}
}
return views;
}
use of org.cytoscape.view.vizmap.VisualStyle in project cytoscape-impl by cytoscape.
the class VizMapperProxy method setCurrentVisualStyle.
public void setCurrentVisualStyle(final VisualStyle vs) {
final VisualStyle curVs = getCurrentVisualStyle();
final VisualMappingManager vmMgr = servicesUtil.get(VisualMappingManager.class);
if (vs != null && !vs.equals(curVs))
vmMgr.setCurrentVisualStyle(vs);
}
use of org.cytoscape.view.vizmap.VisualStyle in project cytoscape-impl by cytoscape.
the class MakeVisualStylesDefaultTask method run.
@Override
public void run(final TaskMonitor monitor) throws Exception {
if (!confirm)
return;
final VisualMappingManager vmMgr = servicesUtil.get(VisualMappingManager.class);
final Set<VisualStyle> currentStyles = vmMgr.getAllVisualStyles();
if (!currentStyles.isEmpty()) {
final VizmapWriterFactory vizmapWriterFactory = servicesUtil.get(VizmapWriterFactory.class);
final CyApplicationConfiguration config = servicesUtil.get(CyApplicationConfiguration.class);
final FileOutputStream os = new FileOutputStream(new File(config.getConfigurationDirectoryLocation(), VizMapperProxy.PRESET_VIZMAP_FILE));
final CyWriter vizmapWriter = vizmapWriterFactory.createWriter(os, currentStyles);
if (!cancelled)
vizmapWriter.run(monitor);
}
}
use of org.cytoscape.view.vizmap.VisualStyle in project cytoscape-impl by cytoscape.
the class RemoveLockedValuesTask method updateView.
private void updateView() {
final VisualStyle style = servicesUtil.get(VisualMappingManager.class).getVisualStyle(netView);
style.apply(netView);
netView.updateView();
}
Aggregations