List of usage examples for javafx.stage FileChooser showSaveDialog
public File showSaveDialog(final Window ownerWindow)
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
@FXML private void onActionButtonSaveCanopyAnalyzerDirections(ActionEvent event) { ChoiceDialog<String> choiceDialog = new ChoiceDialog<>(); choiceDialog.getItems().addAll("OBJ", "CSV (spherical coordinates)", "CSV (cartesian coordinates)"); choiceDialog.setSelectedItem("OBJ"); choiceDialog.setTitle("Output format"); choiceDialog.setContentText("Choose the output format"); Optional<String> result = choiceDialog.showAndWait(); if (result.isPresent()) { String format = result.get(); boolean csv = (format.equals("CSV (spherical coordinates)") || format.equals("CSV (cartesian coordinates)")); boolean cartesian = format.equals("CSV (cartesian coordinates)") && csv; FileChooser fc = new FileChooser(); File selectedFile = fc.showSaveDialog(stage); if (selectedFile != null) { LAI2xxx lAi2xxx = new LAI2200( comboboxChooseCanopyAnalyzerSampling.getSelectionModel().getSelectedItem(), LAI2xxx.ViewCap.CAP_360, new boolean[] { false, false, false, false, false }); lAi2xxx.computeDirections(); Vector3f[] directions = lAi2xxx.getDirections(); try (BufferedWriter writer = new BufferedWriter(new FileWriter(selectedFile))) { if (csv) { if (cartesian) { writer.write("X_cartesian Y_cartesian Z_cartesian\n"); } else { writer.write("azimut elevation\n"); }//from w ww.jav a2 s . c om } SphericalCoordinates sc = new SphericalCoordinates(); for (Vector3f direction : directions) { if (csv) { if (cartesian) { writer.write(direction.x + " " + direction.y + " " + direction.z + "\n"); } else { sc.toSpherical(new Vector3d(direction)); writer.write(sc.getAzimut() + " " + sc.getZenith() + "\n"); } } else { writer.write("v " + direction.x + " " + direction.y + " " + direction.z + "\n"); } } } catch (IOException ex) { showErrorDialog(ex); } } } }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @throws IOException Exception d'entre sortie *///from w w w . j a v a2 s . co m private static void projetSauveSous() throws IOException { if (!bRepertSauveChoisi) { setStrRepertoireProjet(getStrCurrentDir()); } FileChooser fcRepertChoix = new FileChooser(); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("fichier panoVisu (*.pvu)", "*.pvu"); fcRepertChoix.getExtensionFilters().add(extFilter); File fileRepert = new File(getStrRepertoireProjet() + File.separator); fcRepertChoix.setInitialDirectory(fileRepert); fileProjet = fcRepertChoix.showSaveDialog(null); if (fileProjet != null) { sauveFichierProjet(); ajouteFichierHisto(fileProjet.getAbsolutePath()); } }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @throws IOException Exception d'entre sortie *//*from w w w . j a v a 2 s . c om*/ private static void projetSauve() throws IOException { if (!bRepertSauveChoisi) { setStrRepertoireProjet(getStrCurrentDir()); } if (fileProjet == null) { FileChooser fcRepertChoix = new FileChooser(); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("fichier panoVisu (*.pvu)", "*.pvu"); fcRepertChoix.getExtensionFilters().add(extFilter); File repert = new File(getStrRepertoireProjet() + File.separator); fcRepertChoix.setInitialDirectory(repert); fileProjet = fcRepertChoix.showSaveDialog(null); } if (fileProjet != null) { sauveFichierProjet(); ajouteFichierHisto(fileProjet.getAbsolutePath()); } }
From source file:org.simmi.GeneSetHead.java
License:asdf
public void newFile() { FileChooser fc = new FileChooser(); fc.getExtensionFilters().add(new ExtensionFilter("Zip files", "*.zip")); File f = fc.showSaveDialog(null); geneset.zippath = f.toPath();/*from w w w . ja va2 s .com*/ }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @throws IOException Exception d'entre sortie *//*from www .j a v a 2 s.com*/ private static void modeleSauver() throws IOException { File fileTemplate; FileChooser fcRepertChoix = new FileChooser(); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("fichier Modle panoVisu (*.tpl)", "*.tpl"); fcRepertChoix.getExtensionFilters().add(extFilter); File fileRepert = new File(getStrRepertAppli() + File.separator + "templates"); if (!fileRepert.exists()) { fileRepert.mkdirs(); } fcRepertChoix.setInitialDirectory(fileRepert); fileTemplate = fcRepertChoix.showSaveDialog(null); if (fileTemplate != null) { String strContenuFichier = getGestionnaireInterface().strGetTemplate(); fileTemplate.setWritable(true); OutputStreamWriter oswTemplate = new OutputStreamWriter(new FileOutputStream(fileTemplate), "UTF-8"); try (BufferedWriter bwTemplate = new BufferedWriter(oswTemplate)) { bwTemplate.write(strContenuFichier); } Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle(rbLocalisation.getString("main.dialog.sauveModele")); alert.setHeaderText(null); alert.setContentText(rbLocalisation.getString("main.dialog.sauveModeleMessage")); alert.showAndWait(); } }