List of usage examples for javafx.scene.control Alert Alert
public Alert(@NamedArg("alertType") AlertType alertType)
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
private void exportDartMaket(final File voxelFile) { Stage exportDartFrame = new Stage(); DartExporterFrameController controller; Parent root;/* w ww. java 2 s . c om*/ if (Util.checkIfVoxelFile(voxelFile)) { try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/export/DartExporterDialog.fxml")); root = loader.load(); controller = loader.getController(); controller.setStage(exportDartFrame); controller.setParent(this); controller.setVoxelFile(voxelFile); exportDartFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } exportDartFrame.show(); } else { logger.error("File is not a voxel file: " + voxelFile.getAbsolutePath()); Alert alert = new Alert(AlertType.CONFIRMATION); alert.setHeaderText("Incorrect file"); alert.setContentText("File is corrupted or cannot be read!\n" + "Do you want to keep it?"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.CANCEL) { listViewProductsFiles.getItems().remove(voxelFile); } } }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
private void getBoundingBoxOfPoints(final boolean quick) { if (textFieldInputFileALS.getText().equals("") && !removeWarnings) { Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("Information"); alert.setHeaderText("An ALS file has to be open"); alert.setContentText("An ALS file has to be open.\nTo proceed select ALS tab and choose a *.las file."); alert.showAndWait();/* ww w .j av a 2 s . co m*/ } else { File file = new File(textFieldInputFileALS.getText()); if (!Files.exists(file.toPath(), LinkOption.NOFOLLOW_LINKS)) { Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("Error"); alert.setHeaderText("File not found"); alert.setContentText("The file " + file.getAbsolutePath() + " cannot be found."); alert.showAndWait(); } else if (FileManager.getExtension(file).equals(".las") || FileManager.getExtension(file).equals(".laz")) { Matrix4d identityMatrix = new Matrix4d(); identityMatrix.setIdentity(); ProgressDialog d; Service<Void> service = new Service<Void>() { @Override protected Task<Void> createTask() { return new Task<Void>() { @Override protected Void call() throws InterruptedException { final BoundingBox3d boundingBox = fr.amap.lidar.amapvox.util.Util .getBoundingBoxOfPoints(new File(textFieldInputFileALS.getText()), resultMatrix, quick, getListOfClassificationPointToDiscard()); Point3d minPoint = boundingBox.min; Point3d maxPoint = boundingBox.max; Platform.runLater(new Runnable() { @Override public void run() { voxelSpacePanelVoxelizationController.getTextFieldEnterXMin() .setText(String.valueOf(minPoint.x)); voxelSpacePanelVoxelizationController.getTextFieldEnterYMin() .setText(String.valueOf(minPoint.y)); voxelSpacePanelVoxelizationController.getTextFieldEnterZMin() .setText(String.valueOf(minPoint.z)); voxelSpacePanelVoxelizationController.getTextFieldEnterXMax() .setText(String.valueOf(maxPoint.x)); voxelSpacePanelVoxelizationController.getTextFieldEnterYMax() .setText(String.valueOf(maxPoint.y)); voxelSpacePanelVoxelizationController.getTextFieldEnterZMax() .setText(String.valueOf(maxPoint.z)); } }); return null; } }; }; }; d = new ProgressDialog(service); d.initOwner(stage); d.setHeaderText("Please wait..."); d.setResizable(true); d.show(); service.start(); } } }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
@FXML private void onActionButtonGetBoundingBox(ActionEvent event) { Mat4D vopMatrixTmp = MatrixUtility.convertMatrix4dToMat4D(vopMatrix); if (vopMatrixTmp == null && checkboxUseVopMatrix.isSelected()) { vopMatrixTmp = Mat4D.identity(); }/* w w w .jav a 2 s.c om*/ final Mat4D transfMatrix = vopMatrixTmp; ObservableList<Node> children = vBoxPointCloudFiltering.getChildren(); final List<PointCloudFilterPaneComponent> tempList = new ArrayList<>(); for (Node n : children) { if (n instanceof PointCloudFilterPaneComponent) { PointCloudFilterPaneComponent comp = (PointCloudFilterPaneComponent) n; tempList.add(comp); } } Service<Void> service = new Service<Void>() { @Override protected Task<Void> createTask() { return new Task<Void>() { @Override protected Void call() throws InterruptedException { final BoundingBox3F boundingBox = new BoundingBox3F(); int count = 0; for (PointCloudFilterPaneComponent pane : tempList) { if (pane.getComboboxPointCloudFilteringType().getSelectionModel() .getSelectedIndex() == 0) { CSVFile file = pane.getCsvFile(); if (Files.exists(file.toPath()) && file.isFile()) { PointCloud pc = new PointCloud(); try { pc.readFromFile(file, transfMatrix); } catch (IOException ex) { } BoundingBox3F boundingBox2; if (count == 0) { boundingBox2 = pc.getBoundingBox(); boundingBox.min = boundingBox2.min; boundingBox.max = boundingBox2.max; } else { boundingBox2 = pc.getBoundingBox(); boundingBox.keepLargest(boundingBox2); } count++; } } } Platform.runLater(new Runnable() { @Override public void run() { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("Information"); alert.setHeaderText("Bounding box:"); alert.setContentText("Minimum: " + "x: " + boundingBox.min.x + " y: " + boundingBox.min.y + " z: " + boundingBox.min.z + "\n" + "Maximum: " + "x: " + boundingBox.max.x + " y: " + boundingBox.max.y + " z: " + boundingBox.max.z + "\n\n" + "Use for voxel space bounding-box?"); alert.initModality(Modality.NONE); Optional<ButtonType> answer = alert.showAndWait(); if (answer.get() == ButtonType.OK) { voxelSpacePanelVoxelizationController.getTextFieldEnterXMin() .setText(String.valueOf(boundingBox.min.x)); voxelSpacePanelVoxelizationController.getTextFieldEnterYMin() .setText(String.valueOf(boundingBox.min.y)); voxelSpacePanelVoxelizationController.getTextFieldEnterZMin() .setText(String.valueOf(boundingBox.min.z)); voxelSpacePanelVoxelizationController.getTextFieldEnterXMax() .setText(String.valueOf(boundingBox.max.x)); voxelSpacePanelVoxelizationController.getTextFieldEnterYMax() .setText(String.valueOf(boundingBox.max.y)); voxelSpacePanelVoxelizationController.getTextFieldEnterZMax() .setText(String.valueOf(boundingBox.max.z)); } } }); return null; } }; } }; ProgressDialog d = new ProgressDialog(service); d.initOwner(stage); d.show(); service.start(); }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
private void exportDartPlots(final File voxelFile) { if (Util.checkIfVoxelFile(voxelFile)) { fileChooserSaveDartFile.setInitialFileName("plots.xml"); fileChooserSaveDartFile.setInitialDirectory(voxelFile.getParentFile()); final File plotFile = fileChooserSaveDartFile.showSaveDialog(stage); if (plotFile != null) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("Coordinate system"); alert.setContentText("Choose your coordinate system"); ButtonType buttonTypeGlobal = new ButtonType("Global"); ButtonType buttonTypeLocal = new ButtonType("Local"); alert.getButtonTypes().setAll(buttonTypeGlobal, buttonTypeLocal); Optional<ButtonType> result = alert.showAndWait(); final boolean global; if (result.get() == buttonTypeGlobal) { global = true;//w w w.j av a2s .c o m } else if (result.get() == buttonTypeLocal) { global = false; } else { return; } final DartPlotsXMLWriter dartPlotsXML = new DartPlotsXMLWriter(); final Service service = new Service() { @Override protected Task createTask() { return new Task<Object>() { @Override protected Object call() throws Exception { dartPlotsXML.writeFromVoxelFile(voxelFile, plotFile, global); return null; } }; } }; ProgressDialog progressDialog = new ProgressDialog(service); progressDialog.show(); service.start(); Button buttonCancel = new Button("cancel"); progressDialog.setGraphic(buttonCancel); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { service.cancel(); dartPlotsXML.setCancelled(true); } }); } } else { logger.error("File is not a voxel file: " + voxelFile.getAbsolutePath()); Alert alert = new Alert(AlertType.CONFIRMATION); alert.setHeaderText("Incorrect file"); alert.setContentText("File is corrupted or cannot be read!\n" + "Do you want to keep it?"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.CANCEL) { listViewProductsFiles.getItems().remove(voxelFile); } } }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @throws IOException Exception d'entre sortie *//*from w w w . j a v a 2s. co m*/ 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(); } }
From source file:editeurpanovisu.EditeurPanovisu.java
public static void creerEditerDiaporama(String strDiaporama) { apCreationDiaporama.getChildren().clear(); apCreationDiaporama.setStyle("-fx-background-color : -fx-base;" + "-fx-border-color: derive(-fx-base,10%);" + "-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.5) , 8, 0.0 , 0 , 8 );" + "-fx-border-width: 1px;"); mbarPrincipal.setDisable(true);// w w w . j av a2 s.c o m bbarPrincipal.setDisable(true); hbBarreBouton.setDisable(true); tpEnvironnement.setDisable(true); Rectangle2D tailleEcran = Screen.getPrimary().getBounds(); int iLargeurEcran = (int) tailleEcran.getWidth(); int iHauteurEcran = (int) tailleEcran.getHeight() - 100; final int iLargeur = 800; final int iHauteur = 630; Label lblNomDiapo = new Label(rbLocalisation.getString("main.nomDiapo")); lblNomDiapo.setLayoutX(30); lblNomDiapo.setLayoutY(45); ComboBox cbListeDiapo = new ComboBox(); cbListeDiapo.setLayoutX(150); cbListeDiapo.setLayoutY(40); cbListeDiapo.setValue(""); for (int i = 0; i < getiNombreDiapo(); i++) { cbListeDiapo.getItems().add(diaporamas[i].getStrNomDiaporama()); } Button btnNouveauDiapo = new Button(rbLocalisation.getString("diapo.nouveau")); btnNouveauDiapo.setLayoutX(iLargeur - 330); btnNouveauDiapo.setLayoutY(20); btnNouveauDiapo.setPrefSize(140, 60); Button btnEffaceDiapo = new Button(rbLocalisation.getString("diapo.efface")); btnEffaceDiapo.setLayoutX(iLargeur - 170); btnEffaceDiapo.setLayoutY(20); btnEffaceDiapo.setPrefSize(140, 60); gestDiapo = new GestionnaireDiaporamaController(); gestDiapo.initDiaporama(); apCreationDiaporama.getChildren().addAll(lblNomDiapo, cbListeDiapo, btnEffaceDiapo, btnNouveauDiapo, gestDiapo.apDiaporama); apCreationDiaporama.setPrefWidth(iLargeur); apCreationDiaporama.setMinWidth(iLargeur); apCreationDiaporama.setMaxWidth(iLargeur); apCreationDiaporama.setPrefHeight(iHauteur); apCreationDiaporama.setMinHeight(iHauteur); apCreationDiaporama.setMaxHeight(iHauteur); apCreationDiaporama.setLayoutX((iLargeurEcran - iLargeur) / 2); apCreationDiaporama.setLayoutY((iHauteurEcran - iHauteur) / 2); apCreationDiaporama.setVisible(true); gestDiapo.addPropertyChangeListener("valideDiapo", (e) -> { mbarPrincipal.setDisable(false); bbarPrincipal.setDisable(false); hbBarreBouton.setDisable(false); tpEnvironnement.setDisable(false); apCreationDiaporama.setVisible(false); gestDiapo.diapoSauve = true; boolean bTrouve = false; int iTrouve = -1; for (int i = 0; i < getiNombreDiapo(); i++) { if (diaporamas[i].getStrNomDiaporama().equals(cbListeDiapo.getValue())) { bTrouve = true; iTrouve = i; } } if (bTrouve) { diaporamas[iTrouve] = gestDiapo.getDiaporama(); try { creeDiaporamaHTML(diaporamas[iTrouve], iTrouve); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } gestDiapo.reInit(new Diaporama()); }); gestDiapo.addPropertyChangeListener("visualiseDiapo", (e) -> { try { creeDiaporamaHTML(gestDiapo.getDiaporama(), -1); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } String strNomFichier = getStrRepertTemp() + File.separator + "diaporama" + File.separator + "diapo-1.html"; webEngine.load("file:///" + strNomFichier); apWebview.getChildren().clear(); browser.setPrefSize(apWebview.getPrefWidth() - 20, apWebview.getPrefHeight() - 50); browser.setTranslateX(10); browser.setTranslateY(10); apWebview.getChildren().add(browser); Button btnOk = new Button("Ok"); btnOk.setPrefSize(100, 20); btnOk.setLayoutX(apWebview.getPrefWidth() - 110); btnOk.setLayoutY(apWebview.getPrefHeight() - 30); apWebview.getChildren().add(btnOk); apWebview.setVisible(true); btnOk.setOnMouseClicked((me) -> { apWebview.setVisible(false); apWebview.getChildren().clear(); }); }); gestDiapo.addPropertyChangeListener("annuleDiapo", (e) -> { mbarPrincipal.setDisable(false); bbarPrincipal.setDisable(false); hbBarreBouton.setDisable(false); tpEnvironnement.setDisable(false); apCreationDiaporama.setVisible(false); gestDiapo.diapoSauve = true; gestDiapo.reInit(new Diaporama()); }); cbListeDiapo.valueProperty().addListener((ov, old_val, new_val) -> { if (new_val != null) { ButtonType reponse = null; ButtonType buttonTypeOui = new ButtonType(rbLocalisation.getString("main.oui")); ButtonType buttonTypeNon = new ButtonType(rbLocalisation.getString("main.non")); if (!gestDiapo.diapoSauve) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle(rbLocalisation.getString("diapo.sauver")); alert.setHeaderText(null); alert.setContentText(rbLocalisation.getString("diapo.sauverTexte")); alert.getButtonTypes().clear(); alert.getButtonTypes().setAll(buttonTypeOui, buttonTypeNon); Optional<ButtonType> actReponse = alert.showAndWait(); reponse = actReponse.get(); } if (reponse == buttonTypeOui) { boolean bTrouve = false; int iTrouve = -1; for (int i = 0; i < getiNombreDiapo(); i++) { if (diaporamas[i].getStrNomDiaporama().equals(old_val)) { bTrouve = true; iTrouve = i; } } if (bTrouve) { diaporamas[iTrouve] = gestDiapo.getDiaporama(); try { creeDiaporamaHTML(diaporamas[iTrouve], iTrouve); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } } gestDiapo.diapoSauve = true; boolean bTrouve = false; int iTrouve = -1; for (int i = 0; i < getiNombreDiapo(); i++) { if (diaporamas[i].getStrNomDiaporama().equals(new_val)) { bTrouve = true; iTrouve = i; } } if (bTrouve) { gestDiapo.setbDisabled(false); gestDiapo.reInit(diaporamas[iTrouve]); } } }); btnNouveauDiapo.setOnMouseClicked((me) -> { ButtonType reponse = null; ButtonType buttonTypeOui = new ButtonType(rbLocalisation.getString("main.oui")); ButtonType buttonTypeNon = new ButtonType(rbLocalisation.getString("main.non")); if (!gestDiapo.diapoSauve) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle(rbLocalisation.getString("diapo.sauver")); alert.setHeaderText(null); alert.setContentText(rbLocalisation.getString("diapo.sauverTexte")); alert.getButtonTypes().clear(); alert.getButtonTypes().setAll(buttonTypeOui, buttonTypeNon); Optional<ButtonType> actReponse = alert.showAndWait(); reponse = actReponse.get(); } if (reponse == buttonTypeOui) { gestDiapo.diapoSauve = true; boolean bTrouve = false; int iTrouve = -1; for (int i = 0; i < getiNombreDiapo(); i++) { if (diaporamas[i].getStrNomDiaporama().equals(cbListeDiapo.getValue())) { bTrouve = true; iTrouve = i; } } if (bTrouve) { diaporamas[iTrouve] = gestDiapo.getDiaporama(); try { creeDiaporamaHTML(diaporamas[iTrouve], iTrouve); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } } TextInputDialog dialog = new TextInputDialog(""); dialog.setTitle(rbLocalisation.getString("main.nomDiapo")); dialog.setHeaderText(null); dialog.setContentText(rbLocalisation.getString("diapo.entrerNom")); Optional<String> resultat = dialog.showAndWait(); if (resultat.isPresent()) { String nomDiapo = resultat.get(); boolean bTrouve = false; for (int i = 0; i < getiNombreDiapo(); i++) { if (diaporamas[i].getStrNomDiaporama().equals(nomDiapo)) { bTrouve = true; } } if (!bTrouve) { diaporamas[getiNombreDiapo()] = new Diaporama(); diaporamas[getiNombreDiapo()].setStrNomDiaporama(nomDiapo); cbListeDiapo.getItems().add(nomDiapo); cbListeDiapo.setValue(nomDiapo); gestDiapo.setbDisabled(false); gestDiapo.reInit(diaporamas[getiNombreDiapo()]); setiNombreDiapo(getiNombreDiapo() + 1); } else { Alert alert = new Alert(AlertType.ERROR); alert.setTitle(rbLocalisation.getString("diapo.erreur")); alert.setHeaderText(null); alert.setContentText(rbLocalisation.getString("diapo.erreurNom")); alert.showAndWait(); } } }); }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * *///from w ww. j a v a2 s .c om private static void retirePanoCourant() { ButtonType buttonTypeOui = new ButtonType(rbLocalisation.getString("main.oui")); ButtonType buttonTypeNon = new ButtonType(rbLocalisation.getString("main.non")); Alert alert = new Alert(AlertType.WARNING); alert.setTitle(rbLocalisation.getString("main.supprimerPano")); alert.setHeaderText(null); alert.setContentText(rbLocalisation.getString("main.etesVousSur")); alert.getButtonTypes().clear(); alert.getButtonTypes().setAll(buttonTypeOui, buttonTypeNon); Optional<ButtonType> actReponse = alert.showAndWait(); if (actReponse.get() == buttonTypeOui) { File fImage; for (int i = 0; i < getPanoramiquesProjet()[getiPanoActuel()].getNombreNiveaux(); i++) { if (getPanoramiquesProjet()[getiPanoActuel()].getStrTypePanoramique().equals(Panoramique.SPHERE)) { fImage = new File(getStrRepertTemp() + File.separator + "panos" + File.separator + "niveau" + i + File.separator + "panovisu" + getiPanoActuel() + ".jpg"); fImage.delete(); } else { String strNom = getStrRepertTemp() + File.separator + "panos" + File.separator + "niveau" + i + File.separator + "panovisu" + getiPanoActuel(); fImage = new File(strNom + "_u.jpg"); fImage.delete(); fImage = new File(strNom + "_d.jpg"); fImage.delete(); fImage = new File(strNom + "_l.jpg"); fImage.delete(); fImage = new File(strNom + "_r.jpg"); fImage.delete(); fImage = new File(strNom + "_f.jpg"); fImage.delete(); fImage = new File(strNom + "_b.jpg"); fImage.delete(); } } if (getPanoramiquesProjet()[getiPanoActuel()].getStrTypePanoramique().equals(Panoramique.SPHERE)) { fImage = new File(getStrRepertTemp() + File.separator + "panos" + File.separator + "panovisu" + getiPanoActuel() + ".jpg"); fImage.delete(); } else { String strNom = getStrRepertTemp() + File.separator + "panos" + File.separator + "panovisu" + getiPanoActuel(); fImage = new File(strNom + "_u.jpg"); fImage.delete(); fImage = new File(strNom + "_d.jpg"); fImage.delete(); fImage = new File(strNom + "_l.jpg"); fImage.delete(); fImage = new File(strNom + "_r.jpg"); fImage.delete(); fImage = new File(strNom + "_f.jpg"); fImage.delete(); fImage = new File(strNom + "_b.jpg"); fImage.delete(); } int iPanCourant = cbListeChoixPanoramique.getSelectionModel().getSelectedIndex(); File fileRemplace; for (int i = iPanCourant; i < getiNombrePanoramiques() - 1; i++) { for (int j = 0; j < getPanoramiquesProjet()[i].getNombreNiveaux(); j++) { if (getPanoramiquesProjet()[getiPanoActuel()].getStrTypePanoramique() .equals(Panoramique.SPHERE)) { fImage = new File(getStrRepertTemp() + File.separator + "panos" + File.separator + "niveau" + j + File.separator + "panovisu" + (i + 1) + ".jpg"); fileRemplace = new File(getStrRepertTemp() + File.separator + "panos" + File.separator + "niveau" + j + File.separator + "panovisu" + i + ".jpg"); fImage.renameTo(fileRemplace); } else { String strNom = getStrRepertTemp() + File.separator + "panos" + File.separator + "niveau" + j + File.separator + "panovisu" + (i + 1); String strNom1 = getStrRepertTemp() + File.separator + "panos" + File.separator + "niveau" + j + File.separator + "panovisu" + i; fImage = new File(strNom + "_u.jpg"); fileRemplace = new File(strNom1 + "_u.jpg"); fImage.renameTo(fileRemplace); fImage = new File(strNom + "_d.jpg"); fileRemplace = new File(strNom1 + "_d.jpg"); fImage.renameTo(fileRemplace); fImage = new File(strNom + "_l.jpg"); fileRemplace = new File(strNom1 + "_l.jpg"); fImage.renameTo(fileRemplace); fImage = new File(strNom + "_r.jpg"); fileRemplace = new File(strNom1 + "_r.jpg"); fImage.renameTo(fileRemplace); fImage = new File(strNom + "_f.jpg"); fileRemplace = new File(strNom1 + "_f.jpg"); fImage.renameTo(fileRemplace); fImage = new File(strNom + "_b.jpg"); fileRemplace = new File(strNom1 + "_b.jpg"); fImage.renameTo(fileRemplace); } } if (getPanoramiquesProjet()[getiPanoActuel()].getStrTypePanoramique().equals(Panoramique.SPHERE)) { fImage = new File(getStrRepertTemp() + File.separator + "panos" + File.separator + "panovisu" + (i + 1) + ".jpg"); fileRemplace = new File(getStrRepertTemp() + File.separator + "panos" + File.separator + "panovisu" + i + ".jpg"); fImage.renameTo(fileRemplace); } else { String strNom = getStrRepertTemp() + File.separator + "panos" + File.separator + "panovisu" + (i + 1); String strNom1 = getStrRepertTemp() + File.separator + "panos" + File.separator + "panovisu" + i; fImage = new File(strNom + "_u.jpg"); fileRemplace = new File(strNom1 + "_u.jpg"); fImage.renameTo(fileRemplace); fImage = new File(strNom + "_d.jpg"); fileRemplace = new File(strNom1 + "_d.jpg"); fImage.renameTo(fileRemplace); fImage = new File(strNom + "_l.jpg"); fileRemplace = new File(strNom1 + "_l.jpg"); fImage.renameTo(fileRemplace); fImage = new File(strNom + "_r.jpg"); fileRemplace = new File(strNom1 + "_r.jpg"); fImage.renameTo(fileRemplace); fImage = new File(strNom + "_f.jpg"); fileRemplace = new File(strNom1 + "_f.jpg"); fImage.renameTo(fileRemplace); fImage = new File(strNom + "_b.jpg"); fileRemplace = new File(strNom1 + "_b.jpg"); fImage.renameTo(fileRemplace); } getPanoramiquesProjet()[i] = getPanoramiquesProjet()[i + 1]; } for (int i = 0; i < getiNombrePanoramiques() - 1; i++) { for (int j = 0; j < getPanoramiquesProjet()[i].getNombreHotspots(); j++) { if (getPanoramiquesProjet()[i].getHotspot(j).getNumeroPano() == iPanCourant) { getPanoramiquesProjet()[i].removeHotspot(j); } } } for (int i = 0; i < getiNombrePanoramiques() - 1; i++) { for (int j = 0; j < getPanoramiquesProjet()[i].getNombreHotspots(); j++) { if (getPanoramiquesProjet()[i].getHotspot(j).getNumeroPano() > iPanCourant) { getPanoramiquesProjet()[i].getHotspot(j) .setNumeroPano(getPanoramiquesProjet()[i].getHotspot(j).getNumeroPano() - 1); } } } for (int i = 0; i < getiNombrePlans(); i++) { for (int j = 0; j < getPlans()[i].getNombreHotspots(); j++) { if (getPlans()[i].getHotspot(j).getNumeroPano() == iPanCourant) { getPlans()[i].removeHotspot(j); } } } for (int i = 0; i < getiNombrePlans(); i++) { for (int j = 0; j < getPlans()[i].getNombreHotspots(); j++) { if (getPlans()[i].getHotspot(j).getNumeroPano() > iPanCourant) { getPlans()[i].getHotspot(j).setNumeroPano(getPlans()[i].getHotspot(j).getNumeroPano() - 1); } } } cbListeChoixPanoramique.setValue(cbListeChoixPanoramique.getItems().get(0)); affichePanoChoisit(0); ordPano.supprimerElement(iPanCourant); apListePanoTriable = ordPano.getApListePanoramiques(); apListePanoTriable.setMaxHeight(apListePanoTriable.getPrefHeight()); apListePanoTriable.setMinHeight(apListePanoTriable.getPrefHeight()); apParametresVisite.setPrefHeight(120 + apListePanoTriable.getPrefHeight() + 20); if (apParametresVisite.isVisible()) { apParametresVisite.setMinHeight(120 + apListePanoTriable.getPrefHeight() + 20); apParametresVisite.setMaxHeight(120 + apListePanoTriable.getPrefHeight() + 20); } rafraichitListePano(); setiNombrePanoramiques(getiNombrePanoramiques() - 1); } }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param stPrimaryStage/*from w w w. ja v a2s . com*/ * @throws Exception Exceptions */ @Override public void start(Stage stPrimaryStage) throws Exception { if (isLinux()) { stPrimaryStage.setFullScreen(true); } File fileRep = new File(""); setbInternet(netIsAvailable()); setStrCurrentDir(fileRep.getAbsolutePath()); setStrRepertAppli(fileRep.getAbsolutePath()); fileRepertConfig = new File(getStrRepertAppli() + File.separator + "configPV"); rbLocalisation = ResourceBundle.getBundle("editeurpanovisu.i18n.PanoVisu", getLocale()); Package pack = Package.getPackage("editeurpanovisu"); strNumVersion = pack.getImplementationVersion() + "-b" + rbLocalisation.getString("build.numero").replace(" ", "").replace("", ""); lisPreferences(); setStPrincipal(stPrimaryStage); stPrimaryStage.setResizable(false); getStPrincipal().setResizable(true); getStPrincipal().setAlwaysOnTop(false); getStPrincipal().setTitle("PanoVisu v" + strNumVersion.split("-")[0]); stPrimaryStage.setMaximized(true); stPrimaryStage.setAlwaysOnTop(false); Rectangle2D tailleEcran = Screen.getPrimary().getBounds(); int iHauteur; if (isMac()) { iHauteur = (int) tailleEcran.getHeight() - 60; } else { iHauteur = (int) tailleEcran.getHeight() - 20; } int iLargeur = (int) tailleEcran.getWidth() - 2; largeurMax = tailleEcran.getWidth() - 450.0d; creeEnvironnement(stPrimaryStage, iLargeur, iHauteur); File fileRepertTempFile = new File(getStrRepertAppli() + File.separator + "temp"); setStrRepertTemp(fileRepertTempFile.getAbsolutePath()); if (!fileRepertTempFile.exists()) { fileRepertTempFile.mkdirs(); } else { deleteDirectory(getStrRepertTemp()); } String strExtTemp = strGenereChaineAleatoire(20); setStrRepertTemp(getStrRepertTemp() + File.separator + "temp" + strExtTemp); fileRepertTempFile = new File(getStrRepertTemp()); fileRepertTempFile.mkdirs(); installeEvenements(); projetsNouveau(); stPrimaryStage.setOnCloseRequest((WindowEvent event) -> { try { sauvePreferences(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } ButtonType reponse = null; ButtonType buttonTypeOui = new ButtonType(rbLocalisation.getString("main.oui")); ButtonType buttonTypeNon = new ButtonType(rbLocalisation.getString("main.non")); ButtonType buttonTypeAnnule = new ButtonType(rbLocalisation.getString("main.annuler")); if (!isbDejaSauve()) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle(rbLocalisation.getString("main.dialog.quitterApplication")); alert.setHeaderText(null); alert.setContentText(rbLocalisation.getString("main.dialog.chargeProjetMessage")); alert.getButtonTypes().clear(); alert.getButtonTypes().setAll(buttonTypeOui, buttonTypeNon, buttonTypeAnnule); Optional<ButtonType> actReponse = alert.showAndWait(); reponse = actReponse.get(); } if (reponse == buttonTypeOui) { try { projetSauve(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } if ((reponse == buttonTypeOui) || (reponse == buttonTypeNon) || (reponse == null)) { try { sauveHistoFichiers(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } deleteDirectory(getStrRepertTemp()); File fileTemp = new File(getStrRepertTemp()); fileTemp.delete(); } else { event.consume(); } }); }