use of org.gephi.io.exporter.plugin.ExporterSpreadsheet in project gephi by gephi.
the class UIExporterSpreadsheetPanel method setup.
public void setup(ExporterSpreadsheet exporter) {
ExporterSpreadsheet.ExportTable tableToExport = exporter.getTableToExport();
if (tableToExport != null) {
tableComboBox.setSelectedIndex(tableToExport == ExporterSpreadsheet.ExportTable.NODES ? 0 : 1);
}
ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
graphModel = projectController.getCurrentWorkspace().getLookup().lookup(GraphModel.class);
refreshColumns();
}
use of org.gephi.io.exporter.plugin.ExporterSpreadsheet in project gephi by gephi.
the class SpreadsheetNGTest method checkNodesSpreadsheet.
private void checkNodesSpreadsheet() throws IOException {
File tmpFile = File.createTempFile(testName, ".csv");
Writer writer = new OutputStreamWriter(new FileOutputStream(tmpFile), "UTF-8");
ExporterSpreadsheet exporter = new ExporterSpreadsheet();
exporter.setWorkspace(workspace);
exporter.setTableToExport(ExporterSpreadsheet.ExportTable.NODES);
exporter.setWriter(writer);
exporter.execute();
String result = Files.readFile(tmpFile).trim().replace("\r", "");
String expected = Files.readFile(SpreadsheetNGTest.class.getResourceAsStream("/org/gephi/io/importer/plugin/file/spreadsheet/expected/" + testName + "_nodes.csv")).trim();
Assert.assertEquals(result, expected);
}
use of org.gephi.io.exporter.plugin.ExporterSpreadsheet in project gephi by gephi.
the class SpreadsheetNGTest method checkEdgesSpreadsheet.
private void checkEdgesSpreadsheet(boolean ignoreId) throws IOException {
File tmpFile = File.createTempFile(testName, ".csv");
Writer writer = new OutputStreamWriter(new FileOutputStream(tmpFile), "UTF-8");
ExporterSpreadsheet exporter = new ExporterSpreadsheet();
exporter.setWorkspace(workspace);
exporter.setTableToExport(ExporterSpreadsheet.ExportTable.EDGES);
exporter.setWriter(writer);
if (ignoreId) {
Table edgeTable = graphController.getGraphModel(workspace).getEdgeTable();
LinkedHashSet<String> columnIdsToExport = new LinkedHashSet<>();
for (Column column : edgeTable) {
if (!column.getId().equals("id")) {
columnIdsToExport.add(column.getId());
}
}
exporter.setColumnIdsToExport(columnIdsToExport);
}
exporter.execute();
String result = Files.readFile(tmpFile).trim().replace("\r", "");
String expected = Files.readFile(SpreadsheetNGTest.class.getResourceAsStream("/org/gephi/io/importer/plugin/file/spreadsheet/expected/" + testName.replace("_AutoDetectImporter", "") + "_edges.csv")).trim();
Assert.assertEquals(result, expected);
}
Aggregations