Search in sources :

Example 6 with CyWriter

use of org.cytoscape.io.write.CyWriter in project cytoscape-impl by cytoscape.

the class SessionWriterImpl method zipNetworkViews.

/**
 * Writes network view files to the session zip.
 * @throws Exception
 */
private void zipNetworkViews() throws Exception {
    final Set<CyNetworkView> netViews = session.getNetworkViews();
    for (final CyNetworkView view : netViews) {
        if (cancelled)
            return;
        String xgmmlFile = SessionUtil.getXGMMLFilename(view);
        zos.putNextEntry(new ZipEntry(sessionDir + NETWORK_VIEWS_FOLDER + xgmmlFile));
        CyWriter writer = networkViewWriterFactory.createWriter(zos, view);
        writer.run(taskMonitor);
        zos.closeEntry();
        writer = null;
    }
}
Also used : ZipEntry(java.util.zip.ZipEntry) CyWriter(org.cytoscape.io.write.CyWriter) CyNetworkView(org.cytoscape.view.model.CyNetworkView)

Example 7 with CyWriter

use of org.cytoscape.io.write.CyWriter in project cytoscape-impl by cytoscape.

the class SessionWriterImpl method zipVizmap.

/**
 * Writes the vizmap.props file to the session zip.
 */
private void zipVizmap() throws Exception {
    Set<VisualStyle> styles = session.getVisualStyles();
    zos.putNextEntry(new ZipEntry(sessionDir + VIZMAP_FILE));
    CyWriter vizmapWriter = vizmapWriterMgr.getWriter(styles, vizmapFilter, zos);
    vizmapWriter.run(taskMonitor);
    zos.closeEntry();
    vizmapWriter = null;
}
Also used : ZipEntry(java.util.zip.ZipEntry) CyWriter(org.cytoscape.io.write.CyWriter) VisualStyle(org.cytoscape.view.vizmap.VisualStyle)

Example 8 with CyWriter

use of org.cytoscape.io.write.CyWriter in project cytoscape-impl by cytoscape.

the class SessionWriterImpl method zipTables.

private void zipTables() throws Exception {
    tableFilenamesBySUID = new HashMap<>();
    Set<CyTableMetadata> tableData = session.getTables();
    for (CyTableMetadata metadata : tableData) {
        if (cancelled)
            return;
        CyTable table = metadata.getTable();
        if (table.getSavePolicy() != SavePolicy.SESSION_FILE)
            continue;
        String tableTitle = SessionUtil.escape(table.getTitle());
        String filename;
        CyNetwork network = metadata.getNetwork();
        if (network == null) {
            filename = String.format("global/%d-%s.cytable", table.getSUID(), tableTitle);
        } else {
            filename = SessionUtil.getNetworkTableFilename(network, metadata);
        }
        tableFilenamesBySUID.put(table.getSUID(), filename);
        zos.putNextEntry(new ZipEntry(sessionDir + TABLES_FOLDER + filename));
        try {
            CyWriter writer = tableWriterMgr.getWriter(table, tableFilter, zos);
            writer.run(taskMonitor);
        } finally {
            zos.closeEntry();
        }
    }
}
Also used : CyTable(org.cytoscape.model.CyTable) ZipEntry(java.util.zip.ZipEntry) CyWriter(org.cytoscape.io.write.CyWriter) CyTableMetadata(org.cytoscape.model.CyTableMetadata) CyNetwork(org.cytoscape.model.CyNetwork)

Aggregations

CyWriter (org.cytoscape.io.write.CyWriter)8 ZipEntry (java.util.zip.ZipEntry)5 CyNetwork (org.cytoscape.model.CyNetwork)3 File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 CyFileFilter (org.cytoscape.io.CyFileFilter)2 CyNetworkView (org.cytoscape.view.model.CyNetworkView)2 VisualStyle (org.cytoscape.view.vizmap.VisualStyle)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Properties (java.util.Properties)1 CyApplicationConfiguration (org.cytoscape.application.CyApplicationConfiguration)1 CyApplicationManager (org.cytoscape.application.CyApplicationManager)1 PresentationWriterManager (org.cytoscape.io.write.PresentationWriterManager)1 VizmapWriterFactory (org.cytoscape.io.write.VizmapWriterFactory)1 CyRow (org.cytoscape.model.CyRow)1 CyTable (org.cytoscape.model.CyTable)1 CyTableMetadata (org.cytoscape.model.CyTableMetadata)1 CyRootNetwork (org.cytoscape.model.subnetwork.CyRootNetwork)1