Search in sources :

Example 1 with VizmapWriterFactory

use of org.cytoscape.io.write.VizmapWriterFactory 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);
    }
}
Also used : FileOutputStream(java.io.FileOutputStream) CyWriter(org.cytoscape.io.write.CyWriter) VisualMappingManager(org.cytoscape.view.vizmap.VisualMappingManager) VisualStyle(org.cytoscape.view.vizmap.VisualStyle) VizmapWriterFactory(org.cytoscape.io.write.VizmapWriterFactory) CyApplicationConfiguration(org.cytoscape.application.CyApplicationConfiguration) File(java.io.File)

Aggregations

File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 CyApplicationConfiguration (org.cytoscape.application.CyApplicationConfiguration)1 CyWriter (org.cytoscape.io.write.CyWriter)1 VizmapWriterFactory (org.cytoscape.io.write.VizmapWriterFactory)1 VisualMappingManager (org.cytoscape.view.vizmap.VisualMappingManager)1 VisualStyle (org.cytoscape.view.vizmap.VisualStyle)1