199200201202203204205206207208209
} private static Graph loadGraph(String directoryPath, String fileName) { File fileHandler = new File(directoryPath + fileName); try { Graph graph= (new GraphMLReader()).readGraph(new FileInputStream(fileHandler)); return graph; } catch (Exception e) { System.err.println(e); System.exit(1); return null; //makes Eclipse happy
626364656667686970717273
//==== If the file exists, open it and save the graph to this.graphML, if it doesn't return false if(openMe.exists()) { try { GraphMLReader graphReader = new GraphMLReader(); this.graphML = graphReader.readGraph(openMe); return true; } catch (Exception e){ System.out.println("Exception "+ e); return false;
265266267268269270271272273274275
if ( datafile == null ) { g = GraphLib.getGrid(15,15); label = "label"; } else { try { g = new GraphMLReader().readGraph(datafile); } catch ( Exception e ) { e.printStackTrace(); System.exit(1); } }
6465666768697071727374
Graph g = null; if ( datafile == null ) { g = GraphLib.getGrid(15,15); } else { try { g = new GraphMLReader().readGraph(datafile); } catch ( Exception e ) { e.printStackTrace(); System.exit(1); } }
320321322323324325326327328329330
jfc.setFileFilter(ff); // GraphML ff = new SimpleFileFilter("xml", "GraphML File (*.xml, *.graphml)", new GraphMLReader()); ff.addExtension("graphml"); ff.addExtension("gz"); jfc.setFileFilter(ff); int retval = jfc.showOpenDialog(c);
231232233234235236237238239240241
} public static JPanel demo(String datafile, final String label) { Graph g = null; try { g = new GraphMLReader().readGraph(datafile); } catch ( Exception e ) { e.printStackTrace(); System.exit(1); } return demo(g, label);