Example #1
0
  protected void fileOpen() {
    JFileChooser chooser = null;
    if (currentFile == null) {
      chooser = new JFileChooser(startDirectory);
    } else {
      chooser = new JFileChooser(currentFile);
    }

    int returnVal = chooser.showOpenDialog(gw);
    if (returnVal == JFileChooser.APPROVE_OPTION) {

      graph.clear();
      currentFile = chooser.getSelectedFile();
      graph.loadAll(currentFile);
      gp.update(gp.getGraphics());
    }
  }
Example #2
0
 protected void fileNew() {
   if (currentFile != null) {
     if (!currentFile.isDirectory()) {
       currentFile = currentFile.getParentFile();
     }
   }
   graph.clear();
   gp.update(gp.getGraphics());
 }
Example #3
0
 protected void fileSave() {
   if (currentFile == null) {
     fileSaveAs();
   } else {
     if (currentFile.isDirectory()) {
       fileSaveAs();
     } else {
       graph.saveAll(currentFile);
       gp.update(gp.getGraphics());
     }
   }
 }
Example #4
0
 protected void fileSaveSimple() {
   JFileChooser chooser = null;
   if (currentFile == null) {
     chooser = new JFileChooser(startDirectory);
   } else {
     chooser = new JFileChooser(currentFile);
     if (!currentFile.isDirectory()) {
       chooser.setSelectedFile(currentFile);
     }
   }
   int returnVal = chooser.showSaveDialog(gw);
   if (returnVal == JFileChooser.APPROVE_OPTION) {
     currentFile = chooser.getSelectedFile();
     graph.saveSimple(currentFile);
   }
 }
Example #5
0
 protected void editSelectAll() {
   gp.getSelection().addNodes(graph.getNodes());
   gp.getSelection().addEdges(graph.getEdges());
   gp.repaint();
 }