/** * Prompts the user to choose a file from their filesystems for our own * devious uses. This method maintains the last directory the user visited * before dismissing the dialog. This does NOT imply they actually chose a * file from that directory, only that they closed the dialog there. It is * the caller's responsibility to check to see if the selected file is * non-null. * @param filename The name of a file with path. If the filename points * to an existing file, the directory in which it lies, will be used * as the starting point for the returned JFileChooser. * * @return the JFileChooser that interacted with the user, after they are * finished using it - null if no file was chosen * @see #promptToOpenFile() */ public static JFileChooser promptToSaveFile(String filename) { return promptToSaveFile(filename, null); }
@Override public void actionPerformed(ActionEvent ev) { if (ev.getSource() == saveTable) { JFileChooser chooser = FileDialoger.promptToSaveFile("summary.csv");//$NON-NLS-1$ if (chooser == null) { return; } try (FileOutputStream fo = new FileOutputStream(chooser.getSelectedFile()); OutputStreamWriter writer = new OutputStreamWriter(fo, Charset.forName("UTF-8"))) { CSVSaveService.saveCSVStats(StatGraphVisualizer.getAllTableData(model, FORMATS),writer, saveHeaders.isSelected() ? StatGraphVisualizer.getLabels(COLUMNS) : null); } catch (IOException e) { JMeterUtils.reportErrorToUser(e.getMessage(), "Error saving data"); } } } }
@Override public void actionPerformed(ActionEvent ev) { if (ev.getSource() == saveTable) { JFileChooser chooser = FileDialoger.promptToSaveFile("aggregate.csv");//$NON-NLS-1$ if (chooser == null) { return; } try (FileOutputStream fo = new FileOutputStream(chooser.getSelectedFile()); OutputStreamWriter writer = new OutputStreamWriter(fo, Charset.forName("UTF-8"))){ CSVSaveService.saveCSVStats(StatGraphVisualizer.getAllTableData(model, StatGraphVisualizer.getFormatters()), writer, saveHeaders.isSelected() ? StatGraphVisualizer.getLabels(StatGraphVisualizer.getColumns()) : null); } catch (IOException e) { JMeterUtils.reportErrorToUser(e.getMessage(), "Error saving data"); } } } }
@Override public void actionPerformed(ActionEvent ev) { if (ev.getSource() == saveTable) { JFileChooser chooser = FileDialoger .promptToSaveFile("synthesis.csv"); if (chooser == null) { return; } FileWriter writer = null; try { writer = new FileWriter(chooser.getSelectedFile()); // TODO // Charset ? CSVSaveService.saveCSVStats(getAllDataAsTable(model, FORMATS, getLabels(COLUMNS)), writer, saveHeaders.isSelected()); } catch (IOException e) { log.warn(e.getMessage()); } finally { JOrphanUtils.closeQuietly(writer); } } }
@Override public void actionPerformed(ActionEvent ev) { if (ev.getSource() == saveTable) { JFileChooser chooser = FileDialoger .promptToSaveFile("synthesis.csv"); if (chooser == null) { return; } FileWriter writer = null; try { writer = new FileWriter(chooser.getSelectedFile()); // TODO // Charset ? CSVSaveService.saveCSVStats(getAllTableData(model, FORMATS), writer, saveHeaders.isSelected() ? getLabels(COLUMNS) : null); } catch (FileNotFoundException e) { log.warn(e.getMessage()); } catch (IOException e) { log.warn(e.getMessage()); } finally { JOrphanUtils.closeQuietly(writer); } } }
private void saveImage(JComponent comp) { JFileChooser chooser = FileDialoger.promptToSaveFile( GuiPackage.getInstance().getTreeListener().getCurrentNode().getName(), extensions);
final JFileChooser chooser = FileDialoger.promptToSaveFile("auth.txt"); //$NON-NLS-1$ if (chooser != null) { tableModel.manager.save(chooser.getSelectedFile().getAbsolutePath());
final JFileChooser chooser = FileDialoger.promptToSaveFile(null); if (chooser != null) { headerManager.save(chooser.getSelectedFile().getAbsolutePath());
JFileChooser chooser = FileDialoger.promptToSaveFile("statistics.csv"); //$NON-NLS-1$ if (chooser == null) { return;
final JFileChooser chooser = FileDialoger.promptToSaveFile("cookies.txt"); //$NON-NLS-1$ if (chooser != null) { ((CookieManager) createTestElement()).save(chooser.getSelectedFile().getAbsolutePath());
JFileChooser chooser = FileDialoger.promptToSaveFile(updateFile == null ? GuiPackage.getInstance().getTreeListener() .getCurrentNode().getName() + JMX_FILE_EXTENSION : updateFile);