List of usage examples for javafx.stage FileChooser setTitle
public final void setTitle(final String value)
From source file:io.github.mzmine.modules.plots.msspectrum.MsSpectrumPlotWindowController.java
public void handleExportTXT(Event event) { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Export to TXT"); fileChooser.getExtensionFilters().add(new ExtensionFilter("TXT", "*.txt")); // Remember last directory if (lastSaveDirectory != null && lastSaveDirectory.isDirectory()) fileChooser.setInitialDirectory(lastSaveDirectory); // Show the file chooser File file = fileChooser.showSaveDialog(chartNode.getScene().getWindow()); // If nothing was chosen, quit if (file == null) return;/*from w ww . j av a2 s.c o m*/ // Save the last open directory lastSaveDirectory = file.getParentFile(); final List<MsSpectrum> spectra = new ArrayList<>(); for (MsSpectrumDataSet dataset : datasets) { spectra.add(dataset.getSpectrum()); } // Do the export in a new thread final File finalFile = file; new Thread(() -> { try { TxtExportAlgorithm.exportSpectra(finalFile, spectra); } catch (Exception e) { MZmineGUI.displayMessage("Unable to export: " + e.getMessage()); e.printStackTrace(); } }).start(); }
From source file:io.github.mzmine.modules.plots.msspectrum.MsSpectrumPlotWindowController.java
public void handleExportMGF(Event event) { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Export to MGF"); fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Mascot Generic Format", "*.mgf")); // Remember last directory if (lastSaveDirectory != null && lastSaveDirectory.isDirectory()) fileChooser.setInitialDirectory(lastSaveDirectory); // Show the file chooser File file = fileChooser.showSaveDialog(chartNode.getScene().getWindow()); // If nothing was chosen, quit if (file == null) return;/*from ww w.j a va 2s . co m*/ // Save the last open directory lastSaveDirectory = file.getParentFile(); final List<MsSpectrum> spectra = new ArrayList<>(); for (MsSpectrumDataSet dataset : datasets) { spectra.add(dataset.getSpectrum()); } // Do the export in a new thread final File finalFile = file; new Thread(() -> { try { MgfFileExportMethod mgfEx = new MgfFileExportMethod(spectra, finalFile); mgfEx.execute(); } catch (Exception e) { MZmineGUI.displayMessage("Unable to export: " + e.getMessage()); e.printStackTrace(); } }).start(); }
From source file:org.noroomattheinn.visibletesla.MainController.java
private void exportCycles(String cycleType) { String initialDir = prefs.storage().get(App.LastExportDirKey, System.getProperty("user.home")); FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Export " + cycleType + " Data"); fileChooser.setInitialDirectory(new File(initialDir)); Stage stage = app.stage;//from w w w . j ava 2 s . c om File file = fileChooser.showSaveDialog(stage); if (file != null) { String enclosingDirectory = file.getParent(); if (enclosingDirectory != null) prefs.storage().put(App.LastExportDirKey, enclosingDirectory); Range<Long> exportPeriod = DateRangeDialog.getExportPeriod(stage); if (exportPeriod == null) return; boolean exported; if (cycleType.equals("Charge")) { exported = vtData.exportCharges(file, exportPeriod); } else { exported = vtData.exportRests(file, exportPeriod); } if (exported) { Dialogs.showInformationDialog(stage, "Your data has been exported", "Data Export Process", "Export Complete"); } else { Dialogs.showErrorDialog(stage, "Unable to save to: " + file, "Data Export Process", "Export Failed"); } } }
From source file:com.rvantwisk.cnctools.controllers.CNCToolsController.java
@FXML public void generateGCode(ActionEvent event) throws Exception { if (v_projectList.getSelectionModel().selectedItemProperty().get() != null) { final Project p = v_projectList.getSelectionModel().selectedItemProperty().get(); if (p.postProcessorProperty().get() == null) { MonologFX dialog = new MonologFX(MonologFX.Type.QUESTION); dialog.setTitleText("No postprocessor"); dialog.setMessage("No post processor configured, please select a post processor first!"); dialog.show();/* ww w . j av a 2s .co m*/ } else { final GCodeCollection gCode = p.getGCode(toolDBManager); gCode.merge(); FileChooser fileChooser = new FileChooser(); fileChooser.getExtensionFilters() .addAll(new FileChooser.ExtensionFilter("NC File", "*.tap", "*.ngc")); fileChooser.setTitle("Save GCode"); File choosenName = fileChooser.showSaveDialog(null); if (choosenName != null) { choosenName.delete(); if (!p.getPostProcessor().isHasToolChanger()) { final GCodeCollection.GeneratedGCode preAmble = gCode.get(0); final GCodeCollection.GeneratedGCode postAmble = gCode.get(gCode.size() - 1); for (int i = 1; i <= (gCode.size() - 2); i++) { final String[] path = choosenName.getPath().split("\\.(?=[^\\.]+$)"); File thisSet = new File(path[0] + "-" + i + "." + path[1]); thisSet.delete(); // Concate all g-code String file = preAmble.getGCode().toString() + SEPERATOR + gCode.get(i).getGCode().toString() + SEPERATOR + postAmble.getGCode().toString() + SEPERATOR; saveGCode(file, thisSet); } } else { saveGCode(gCode.concate().toString(), choosenName); } } } } }
From source file:io.github.mzmine.modules.plots.msspectrum.MsSpectrumPlotWindowController.java
public void handleExportMzML(Event event) { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Export to mzML"); fileChooser.getExtensionFilters().add(new ExtensionFilter("mzML", "*.mzML")); // Remember last directory if (lastSaveDirectory != null && lastSaveDirectory.isDirectory()) fileChooser.setInitialDirectory(lastSaveDirectory); // Show the file chooser File file = fileChooser.showSaveDialog(chartNode.getScene().getWindow()); // If nothing was chosen, quit if (file == null) return;//from www. j av a2s . c o m // Save the last open directory lastSaveDirectory = file.getParentFile(); final List<MsSpectrum> spectra = new ArrayList<>(); for (MsSpectrumDataSet dataset : datasets) { spectra.add(dataset.getSpectrum()); } // Do the export in a new thread final File finalFile = file; new Thread(() -> { try { // Create a temporary raw data file DataPointStore tmpStore = DataPointStoreFactory.getMemoryDataStore(); RawDataFile tmpRawFile = MSDKObjectBuilder.getRawDataFile("Exported spectra", null, FileType.UNKNOWN, tmpStore); int scanNum = 1; for (MsSpectrumDataSet dataset : datasets) { MsSpectrum spectrum = dataset.getSpectrum(); MsScan newScan; if (spectrum instanceof MsScan) { newScan = MsScanUtil.clone(tmpStore, (MsScan) spectrum, true); } else { MsFunction msf = MSDKObjectBuilder.getMsFunction(MsFunction.DEFAULT_MS_FUNCTION_NAME); newScan = MSDKObjectBuilder.getMsScan(tmpStore, scanNum, msf); } tmpRawFile.addScan(newScan); } MzMLFileExportMethod exporter = new MzMLFileExportMethod(tmpRawFile, finalFile); exporter.execute(); tmpRawFile.dispose(); } catch (Exception e) { MZmineGUI.displayMessage("Unable to export: " + e.getMessage()); e.printStackTrace(); } }).start(); }
From source file:ninja.javafx.smartcsv.fx.SmartCSVController.java
@FXML public void export(ActionEvent actionEvent) { final FileChooser fileChooser = new FileChooser(); //Set extension filter final FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(EXPORT_LOG_FILTER_TEXT, EXPORT_LOG_FILTER_EXTENSION); fileChooser.getExtensionFilters().add(extFilter); fileChooser.setTitle("Save"); //Show open file dialog File file = fileChooser.showSaveDialog(applicationPane.getScene().getWindow()); if (file != null) { errorExport.setCsvFilename(currentCsvFile.getFile().getName()); errorExport.setModel(currentCsvFile.getContent()); errorExport.setFile(file);//from w w w .j a v a 2s .co m errorExport.setResourceBundle(resourceBundle); errorExport.restart(); } }
From source file:dsfixgui.view.DSPWPane.java
private void initializeEventHandlers() { applySettingsButton.setOnAction(e -> { ui.applyDSPWConfig();/* w w w. j a va 2s . c o m*/ }); restoreDefaultsButton.setOnAction(e -> { ContinueDialog cD = new ContinueDialog(300.0, 80.0, DIALOG_TITLE_RESET, DIALOG_MSG_RESTORE_SETTINGS, DIALOG_BUTTON_TEXTS[2], DIALOG_BUTTON_TEXTS[1]); if (cD.show()) { config.restoreDefaults(); ui.refreshUI(); } }); versionBannerOn.setOnAction(e -> { config.ShowVersionBanner.replace(0, config.ShowVersionBanner.length(), TRUE_FALSE[0]); }); versionBannerOff.setOnAction(e -> { config.ShowVersionBanner.replace(0, config.ShowVersionBanner.length(), TRUE_FALSE[1]); }); overlayOn.setOnAction(e -> { config.ShowOverlay.replace(0, config.ShowOverlay.length(), TRUE_FALSE[0]); }); overlayOff.setOnAction(e -> { config.ShowOverlay.replace(0, config.ShowOverlay.length(), TRUE_FALSE[1]); }); invasionNotifOn.setOnAction(e -> { config.InvasionSoundNotification.replace(0, config.InvasionSoundNotification.length(), TRUE_FALSE[0]); }); invasionNotifOff.setOnAction(e -> { config.InvasionSoundNotification.replace(0, config.InvasionSoundNotification.length(), TRUE_FALSE[1]); }); cheaterNotifOn.setOnAction(e -> { config.CheaterSoundNotification.replace(0, config.CheaterSoundNotification.length(), TRUE_FALSE[0]); }); cheaterNotifOff.setOnAction(e -> { config.CheaterSoundNotification.replace(0, config.CheaterSoundNotification.length(), TRUE_FALSE[1]); }); blockArenaFreezeOn.setOnAction(e -> { config.BlockArenaFreeze.replace(0, config.BlockArenaFreeze.length(), TRUE_FALSE[0]); }); blockArenaFreezeOff.setOnAction(e -> { config.BlockArenaFreeze.replace(0, config.BlockArenaFreeze.length(), TRUE_FALSE[1]); }); nodeCountOn.setOnAction(e -> { config.ShowNodeDbCount.replace(0, config.ShowNodeDbCount.length(), TRUE_FALSE[0]); }); nodeCountOff.setOnAction(e -> { config.ShowNodeDbCount.replace(0, config.ShowNodeDbCount.length(), TRUE_FALSE[1]); }); increaseNodesOn.setOnAction(e -> { config.IncreaseNodeDbLimit.replace(0, config.IncreaseNodeDbLimit.length(), TRUE_FALSE[0]); }); increaseNodesOff.setOnAction(e -> { config.IncreaseNodeDbLimit.replace(0, config.IncreaseNodeDbLimit.length(), TRUE_FALSE[1]); }); dateOn.setOnAction(e -> { config.DisplayDate.replace(0, config.DisplayDate.length(), TRUE_FALSE[0]); }); dateOff.setOnAction(e -> { config.DisplayDate.replace(0, config.DisplayDate.length(), TRUE_FALSE[1]); }); timeOn.setOnAction(e -> { config.DisplayClock.replace(0, config.DisplayClock.length(), TRUE_FALSE[0]); }); timeOff.setOnAction(e -> { config.DisplayClock.replace(0, config.DisplayClock.length(), TRUE_FALSE[1]); }); updateOn.setOnAction(e -> { config.CheckForUpdates.replace(0, config.CheckForUpdates.length(), TRUE_FALSE[0]); }); updateOff.setOnAction(e -> { config.CheckForUpdates.replace(0, config.CheckForUpdates.length(), TRUE_FALSE[1]); }); textAlignmentLeft.setOnAction(e -> { config.TextAlignment.replace(0, config.TextAlignment.length(), DSPW_TEXT_ALIGNMENT_OPTIONS[0]); }); textAlignmentCenter.setOnAction(e -> { config.TextAlignment.replace(0, config.TextAlignment.length(), DSPW_TEXT_ALIGNMENT_OPTIONS[1]); }); textAlignmentRight.setOnAction(e -> { config.TextAlignment.replace(0, config.TextAlignment.length(), DSPW_TEXT_ALIGNMENT_OPTIONS[2]); }); fontSizeField.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldText, String newText) { try { if (!NumberUtils.isParsable(newText) || Integer.parseInt(newText) > 72 || Integer.parseInt(newText) < 15) { fontSizeField.pseudoClassStateChanged(INVALID_INPUT, true); } else { fontSizeField.pseudoClassStateChanged(INVALID_INPUT, false); config.FontSize.replace(0, config.FontSize.length(), "" + Integer.parseInt(newText)); } } catch (NumberFormatException nFE) { ui.printConsole(INPUT_TOO_LARGE); fontSizeField.setText(""); } } }); dllChainButton.setOnAction(e -> { FileChooser dllChooser = new FileChooser(); dllChooser.setTitle(DIALOG_TITLE_DLL); if (ui.getDataFolder() != null) { dllChooser.setInitialDirectory(ui.getDataFolder()); } ExtensionFilter dllFilter = new ExtensionFilter(DLL_EXT_FILTER[0], DLL_EXT_FILTER[1]); dllChooser.getExtensionFilters().add(dllFilter); File dll = dllChooser.showOpenDialog(ui.getStage()); if (dll != null && ui.getDataFolder() != null) { File checkDLL = new File(ui.getDataFolder() + "\\" + dll.getName()); if (!checkDLL.exists()) { AlertDialog aD = new AlertDialog(300.0, 80.0, DIALOG_TITLE_WRONG_FOLDER, DLL_MUST_BE_IN_DATA, DIALOG_BUTTON_TEXTS[0]); } else { if (dll.getName().equals(DSM_FILES[0])) { AlertDialog aD = new AlertDialog(300.0, 80.0, INVALID_DLL, CANT_CHAIN_DLL_WITH_DSM, DIALOG_BUTTON_TEXTS[0]); } else if (dll.getName().equals(DSF_FILES[0])) { AlertDialog aD = new AlertDialog(300.0, 80.0, INVALID_DLL, CANT_CHAIN_DLL_WITH_DSF, DIALOG_BUTTON_TEXTS[0]); } else if (dll.getName().equals(DS_DEFAULT_DLLS[0]) || dll.getName().equals(DS_DEFAULT_DLLS[1]) || dll.getName().equals(DS_DEFAULT_DLLS[2])) { AlertDialog aD = new AlertDialog(300.0, 80.0, INVALID_DLL, CANT_CHAIN_DLL_WITH_DEFAULT, DIALOG_BUTTON_TEXTS[0]); } else if (dll.getName().equals(DSPW_FILES[1]) || dll.getName().equals(DSPW_FILES[4]) || dll.getName().equals(DSPW_FILES[5])) { AlertDialog aD = new AlertDialog(300.0, 80.0, INVALID_DLL, CANT_CHAIN_DSPW_WITH_DSPW, DIALOG_BUTTON_TEXTS[0]); } else { config.d3d9dllWrapper.replace(0, config.d3d9dllWrapper.length(), dll.getName()); dllChainField.setText(dll.getName()); dllChainField.setStyle("-fx-text-fill: black;"); noChainButton.setDisable(false); } } } }); noChainButton.setOnAction(e -> { dllChainField.setText(NONE); noChainButton.setDisable(true); dllChainField.setStyle("-fx-text-fill: gray;"); config.d3d9dllWrapper.replace(0, config.d3d9dllWrapper.length(), NONE); }); banPicker.setOnAction(e -> { config.key_BanPhantom.replace(0, config.key_BanPhantom.length(), keybindsHex.get(keybinds.indexOf(banPicker.getValue()))); }); ignorePicker.setOnAction(e -> { config.key_IgnorePhantom.replace(0, config.key_IgnorePhantom.length(), keybindsHex.get(keybinds.indexOf(ignorePicker.getValue()))); }); toggleOverlayPicker.setOnAction(e -> { config.key_HideOverlay.replace(0, config.key_HideOverlay.length(), keybindsHex.get(keybinds.indexOf(toggleOverlayPicker.getValue()))); }); aboutPicker.setOnAction(e -> { config.key_AboutDSPW.replace(0, config.key_AboutDSPW.length(), keybindsHex.get(keybinds.indexOf(aboutPicker.getValue()))); }); }
From source file:condorclient.CreateJobDialogController.java
/** * Initializes the controller class./*w w w . j a v a 2s. c o m*/ */ @FXML private void infoFileChooserFired(ActionEvent event) { final FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("??"); fileChooser.setInitialDirectory(new File(infoFileInitialDir)); fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("IXL", "*.ixl")); File file = fileChooser.showOpenDialog(this.stage); if (file != null) { infoFileText.setText(file.getAbsolutePath()); infoFileInitialDir = file.getParent(); System.out.println("infoFileInitialDir:" + infoFileInitialDir); // System.out.println(file.getName()); // openFile(file); } infoOk = true; enableButton(); }
From source file:condorclient.CreateJobDialogController.java
@FXML private void expFileChooserFired(ActionEvent event) { final FileChooser fileChooser = new FileChooser(); fileChooser.setTitle(""); fileChooser.setInitialDirectory(new File(expFileInitialDir)); fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("EXL", "*.exl")); File file = fileChooser.showOpenDialog(this.stage); String s = ""; if (file != null) { expFileText.setText(file.getAbsolutePath()); expFileInitialDir = file.getParent(); XMLHandler handler = new XMLHandler(); s = handler.getNRun(file.getAbsolutePath()); }/* www . j a v a2 s . c om*/ sampleNumText.setText(s); sampleNumText.setDisable(true); //? expOk = true; enableButton(); }