use of net.sf.mzmine.parameters.parametertypes.filenames.FileNameParameter in project mzmine2 by mzmine.
the class SpectralMatchPanel method exportToGraphics.
/**
* Export the whole panel to pdf, emf, eps or all
*
* @param format
*/
public void exportToGraphics(String format) {
// old path
FileNameParameter param = MZmineCore.getConfiguration().getModuleParameters(SpectraIdentificationResultsModule.class).getParameter(SpectraIdentificationResultsParameters.file);
final JFileChooser chooser;
if (param.getValue() != null) {
chooser = new JFileChooser();
chooser.setSelectedFile(param.getValue());
} else
chooser = new JFileChooser();
// get file
if (chooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
try {
File f = chooser.getSelectedFile();
pnExport.setVisible(false);
pnExport.revalidate();
pnExport.getParent().revalidate();
pnExport.getParent().repaint();
SwingExportUtil.writeToGraphics(this, f.getParentFile(), f.getName(), format);
// save path
param.setValue(FileAndPathUtil.eraseFormat(f));
} catch (Exception ex) {
logger.log(Level.WARNING, "Cannot export graphics of spectra match panel", ex);
} finally {
pnExport.setVisible(true);
pnExport.getParent().revalidate();
pnExport.getParent().repaint();
}
}
}
Aggregations