From 7540decb64bbd5c6218a6df60e8686c7329afe6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Dervaux?= <stephane.dervaux@inrae.fr> Date: Tue, 27 Feb 2024 17:08:12 +0100 Subject: [PATCH 1/4] remove substep menu for step with father --- src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java | 2 +- 1 file changed, 1 insertion(+), 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 53c402bb..dcb0f8fb 100644 --- a/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java +++ b/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java @@ -754,7 +754,7 @@ public class DataTreeCell extends TextFieldTreeCell<DataNode> { newSubStep.setOnAction(event -> { addStep(item.getItineraryFile(),s ); }); - menu.getItems().add(newSubStep); + if (s.getFather() == null) menu.getItems().add(newSubStep); MenuItem newObs = new MenuItem("New Observation File"); newObs.setGraphic(new ImageView(UITools.getImage("resources/images/treeview/observation.png"))); -- GitLab From bad16c4c39188410e1bbb0d64492422ed52860e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Dervaux?= <stephane.dervaux@inrae.fr> Date: Thu, 29 Feb 2024 11:59:00 +0100 Subject: [PATCH 2/4] block adding substep in substep --- .../java/fr/inra/po2vocabmanager/utils/DataTreeCell.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java b/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java index dcb0f8fb..240d47c6 100644 --- a/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java +++ b/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java @@ -188,6 +188,15 @@ public class DataTreeCell extends TextFieldTreeCell<DataNode> { public void addStep(ItineraryFile itineraryFile, StepFile parentStep) { + if(parentStep.getFather() != null) { + Alert notPossible = new Alert(Alert.AlertType.INFORMATION); + notPossible.setTitle("Add substep"); + notPossible.setContentText("Adding substep here is not allowed"); + notPossible.initModality(Modality.APPLICATION_MODAL); + notPossible.initOwner(MainApp.primaryStage); + notPossible.showAndWait(); + return; + } GeneralFile current = itineraryFile.getProcessFile(); -- GitLab From 1d36abf8046cf682e07171e853ef94efa90fe483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Dervaux?= <stephane.dervaux@inrae.fr> Date: Thu, 29 Feb 2024 15:31:20 +0100 Subject: [PATCH 3/4] remove add composition on box step --- src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java | 2 +- 1 file changed, 1 insertion(+), 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 240d47c6..4cfe6486 100644 --- a/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java +++ b/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java @@ -887,7 +887,7 @@ public class DataTreeCell extends TextFieldTreeCell<DataNode> { // }); - menu.getItems().add(newMix); + if (s.getSubStep().isEmpty()) menu.getItems().add(newMix); MenuItem exportStep = new MenuItem("Export Step"); -- GitLab From 3c55078005a2cb7e6bf9b6a2ee8a453745d14074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Dervaux?= <stephane.dervaux@inrae.fr> Date: Thu, 29 Feb 2024 15:31:43 +0100 Subject: [PATCH 4/4] new context menu for remove step from his father --- .../po2vocabmanager/utils/DataTreeCell.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java b/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java index 4cfe6486..46f94148 100644 --- a/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java +++ b/src/main/java/fr/inra/po2vocabmanager/utils/DataTreeCell.java @@ -918,17 +918,16 @@ public class DataTreeCell extends TextFieldTreeCell<DataNode> { noOntology.showAndWait(); } else { XSSFWorkbook book = new XSSFWorkbook(); - StepFile f = (StepFile) item.getFile(); Boolean finalExportOnto = exportOnto; Task<Boolean> taskExport = new Task<Boolean>() { @Override protected Boolean call() throws Exception { - XSSFSheet sheet = book.createSheet("step|"+ DigestUtils.md5Hex(f.getNameProperty().getValue())); + XSSFSheet sheet = book.createSheet("step|"+ DigestUtils.md5Hex(s.getNameProperty().getValue())); Integer compteur = 0; Integer maxColumn = 0; - for (LinkedList<String> line : f.getDataForExcel(true)) { + for (LinkedList<String> line : s.getDataForExcel(true)) { XSSFRow r = sheet.createRow(compteur++); Integer compteurCell = 0; for (String val : line) { @@ -939,7 +938,7 @@ public class DataTreeCell extends TextFieldTreeCell<DataNode> { // composition - for (Map.Entry<CompositionFile, Boolean> entry : f.getCompositionFile().entrySet()) { + for (Map.Entry<CompositionFile, Boolean> entry : s.getCompositionFile().entrySet()) { XSSFSheet sheetCompo = book.createSheet("compo-"+(entry.getValue() ? "input" : "output")+"|"+entry.getKey().getCompositionID().getValue().get()); Integer compteurCompo = 0; Integer maxColumnCompo = 0; @@ -958,7 +957,7 @@ public class DataTreeCell extends TextFieldTreeCell<DataNode> { Tools.autoResize(sheet, maxColumn); - for(ObservationFile obs : f.getObservationFiles()) { + for(ObservationFile obs : s.getObservationFiles()) { XSSFSheet sheetObs = book.createSheet("obs|"+obs.getCID().getValue().get()); Integer compteurObs = 0; @@ -1016,7 +1015,7 @@ public class DataTreeCell extends TextFieldTreeCell<DataNode> { taskExport.setOnSucceeded(workerStateEvent -> { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Export file"); - fileChooser.setInitialFileName(f.getNameProperty().getValue()+".xlsx"); + fileChooser.setInitialFileName(s.getNameProperty().getValue()+".xlsx"); File fileExport = fileChooser.showSaveDialog(MainApp.primaryStage); if (fileExport != null) { try { @@ -1185,6 +1184,18 @@ public class DataTreeCell extends TextFieldTreeCell<DataNode> { } }); + MenuItem removeStepFromParent = new MenuItem("Remove Step from his parent"); + removeStepFromParent.setGraphic(new ImageView(UITools.getImage("resources/images/del_16.png"))); + removeStepFromParent.disableProperty().bind(Bindings.not(mainApp.getEditProperty())); + removeStepFromParent.setOnAction(event -> { + StepFile stepFile = (StepFile) item.getFile(); + stepFile.removeFather(); + ItineraryFile itiFile = item.getItineraryFile(); + MainApp.getDataControler().buildItineraryTree(itiFile); + MainApp.getDataControler().selectNode(itiFile); + }); + if (s.getFather() != null) menu.getItems().add(removeStepFromParent); + MenuItem removeStepIti = new MenuItem("Remove Step from itinerary"); removeStepIti.setGraphic(new ImageView(UITools.getImage("resources/images/del_16.png"))); removeStepIti.disableProperty().bind(Bindings.not(mainApp.getEditProperty())); -- GitLab