From 4a94c2d77f1caa8e64fc2570ddea5d0274061007 Mon Sep 17 00:00:00 2001 From: stephane <stephane.dervaux@inrae.fr> Date: Wed, 24 Apr 2024 14:44:54 +0200 Subject: [PATCH] add warning if compo existe on creating substep --- .../fr/inra/po2vocabmanager/utils/DataTreeCell.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java b/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java index 4a575cd5..2ce0b003 100644 --- a/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java +++ b/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java @@ -233,7 +233,7 @@ public class DataTreeCell extends TextFieldTreeCell<DataNode> { VBox vd = new VBox(5); RadioButton rbScratch = new RadioButton("Create from scratch"); - RadioButton rbCopy = new RadioButton("Copy an existing step (BETA) :"); + RadioButton rbCopy = new RadioButton("Copy an existing step :"); rbCopy.setGraphic(new ImageView(UITools.getImage("resources/images/help_16.png"))); rbCopy.setTooltip(new Tooltip("Itineraries are not cloned")); rbCopy.setContentDisplay(ContentDisplay.RIGHT); @@ -274,6 +274,16 @@ public class DataTreeCell extends TextFieldTreeCell<DataNode> { bok.disableProperty().bind(Bindings.or(nextStepName.textProperty().isEmpty(), Bindings.and(rbCopy.selectedProperty(), comboStep.valueProperty().isNull()))); bok.setOnAction(actionEvent -> { addStepData(itineraryFile, parentStep, current, nextStepName.getText(), rbCopy.isSelected(), comboStep); + if(parentStep != null && !parentStep.getCompositionFile().isEmpty()) { + Platform.runLater(() -> { + Alert warningMoveComposition = new Alert(Alert.AlertType.WARNING); + warningMoveComposition.setTitle("Composition on " + parentStep.getNameProperty().get()); + warningMoveComposition.setContentText("Please keep in mind that composition on step " + parentStep.getNameProperty().get() + " are not allowed.\n You can move or remove it"); + warningMoveComposition.initModality(Modality.APPLICATION_MODAL); + warningMoveComposition.initOwner(MainApp.primaryStage); + warningMoveComposition.showAndWait(); + }); + } }); diagNewStep.showAndWait(); -- GitLab