Changeset 2826


Ignore:
Timestamp:
05/25/07 15:23:10 (13 years ago)
Author:
sorber
Message:

Added basic automatic spreadsheet launching.

Location:
trunk/loci/visbio/overlays
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/overlays/OverlayWidget.java

    r2823 r2826  
    702702      int rval = overlayXLSBox.showDialog(this, "Export"); 
    703703      if (rval != JFileChooser.APPROVE_OPTION) return; 
    704       // TODO save current options to OverlayManager 
    705704      File file = overlayXLSBox.getSelectedFile(); 
    706705      statsPane.saveSettings(); 
     
    708707        FileOutputStream fout = new FileOutputStream(file); 
    709708        HSSFWorkbook wb = overlay.exportOverlays(); 
    710         wb.write(fout); 
     709        wb.write(fout); // TODO use a task here... this can be slow for  
     710        // really big overlay sets 
    711711        fout.close(); 
     712        launchSpreadsheet(file); 
    712713      } 
    713714      catch (IOException exc) { 
     
    868869    if (!updateGUI) ignoreEvents = false; 
    869870  } 
     871 
     872  /** Launches the spreadsheet */ 
     873  protected void launchSpreadsheet(File file) { 
     874    try { 
     875      SpreadsheetLauncher launcher = new SpreadsheetLauncher(); 
     876      launcher.launchSpreadsheet(file); 
     877    } 
     878    catch (SpreadsheetLaunchException ex) { 
     879      displayErrorMessage(ex.getMessage()); 
     880    } 
     881  } 
     882 
     883  /** Displays an error message */ 
     884  protected void displayErrorMessage(String message) { 
     885    JOptionPane.showMessageDialog((JComponent) this, message,  
     886        "Could not launch spreadsheet", JOptionPane.ERROR_MESSAGE); 
     887  } 
    870888} 
Note: See TracChangeset for help on using the changeset viewer.