From 86c4875c54d20862baa2861d07879519226a89bb Mon Sep 17 00:00:00 2001
From: stephane <stephane.dervaux@inrae.fr>
Date: Wed, 16 Oct 2024 12:16:16 +0200
Subject: [PATCH] add a warning on reset node position

---
 .../view/dataView/ItineraryOverviewController.java   | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/main/java/fr/inra/po2vocabmanager/view/dataView/ItineraryOverviewController.java b/src/main/java/fr/inra/po2vocabmanager/view/dataView/ItineraryOverviewController.java
index 64ed7180..6f053344 100644
--- a/src/main/java/fr/inra/po2vocabmanager/view/dataView/ItineraryOverviewController.java
+++ b/src/main/java/fr/inra/po2vocabmanager/view/dataView/ItineraryOverviewController.java
@@ -236,8 +236,16 @@ public class ItineraryOverviewController {
 
 
         resetLayout.setOnAction(actionEvent -> {
-            this.itiFile.clearNodePosition();
-            drawGraph();
+            Alert confirmationResetNode = new Alert(Alert.AlertType.CONFIRMATION);
+            confirmationResetNode.initOwner(MainApp.primaryStage);
+            confirmationResetNode.setTitle("Warning");
+            confirmationResetNode.setHeaderText("Warning");
+            confirmationResetNode.setContentText("Recalculating the graph layout will reset the current positions of the nodes. All manual positioning will be lost. Do you really want to continue ?");
+            Optional<ButtonType> result = confirmationResetNode.showAndWait();
+            if(result.isPresent() && result.get() == ButtonType.OK) {
+                this.itiFile.clearNodePosition();
+                drawGraph();
+            }
         });
 
         exportImg.setOnAction(actionEvent -> {
-- 
GitLab