From b3d0580439b9a00c7eb918085de1694151066004 Mon Sep 17 00:00:00 2001
From: Kenmegne <stephanie.kenmegne@gmail.com>
Date: Thu, 18 Jun 2026 16:02:49 +0000
Subject: [PATCH] rename packages

---
 fdx_convert/src/main/java/com/megatim/fdxconvert/forms/ValidateurEditFormController.java |  147 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 147 insertions(+), 0 deletions(-)

diff --git a/fdx_convert/src/main/java/com/megatim/fdxconvert/forms/ValidateurEditFormController.java b/fdx_convert/src/main/java/com/megatim/fdxconvert/forms/ValidateurEditFormController.java
new file mode 100644
index 0000000..498c9c1
--- /dev/null
+++ b/fdx_convert/src/main/java/com/megatim/fdxconvert/forms/ValidateurEditFormController.java
@@ -0,0 +1,147 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
+ */
+package com.megatim.fdxconvert.forms;
+
+import com.megatimfx.common.annontations.Champ;
+import com.megatimfx.common.customcontrols.AbstractSelectionItem;
+import com.megatimfx.common.customcontrols.CustomFileChooser;
+import com.megatimfx.components.customdialogs.AlertMessageUtil;
+import com.megatimfx.components.customdialogs.LoadinIndicatorDialogUtil;
+import com.megatim.fdxconvert.controller.table.TypeFichierTable;
+import com.megatim.fdxconvert.model.TypeFichier;
+import com.megatim.fdxconvert.service.TypeFichierService;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.ResourceBundle;
+import java.util.Set;
+import javafx.concurrent.Task;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.PasswordField;
+import javafx.scene.control.TextField;
+import javafx.scene.image.ImageView;
+import javafx.scene.input.MouseEvent;
+import javafx.util.Pair;
+
+/**
+ *
+ * @author STEPHANIE
+ */
+public class ValidateurEditFormController implements Initializable {
+
+    @FXML
+    @Champ(mappedBy = "typeFichier", type = TypeFichier.class, update = false)
+    private AbstractSelectionItem<TypeFichier> typeFichierAbstractSelectItem;
+
+    @FXML
+    @Champ(mappedBy = "filePath")
+    private CustomFileChooser FileToImport;
+
+    @FXML
+    @Champ(mappedBy = "keyToDecrypt")
+    private PasswordField keyToDecryptField;
+
+    @FXML
+    @Champ(mappedBy = "keyConfirmation")
+    private PasswordField keyConfirmationField;
+
+    @FXML
+    private TextField showKeyTextField;
+
+    @FXML
+    private ImageView eyeImageView;
+
+    @FXML
+    @Champ(mappedBy = "protege", type = Boolean.class)
+    private CheckBox protegeCheckBox;
+
+    private boolean passwordVisible;
+
+    private final TypeFichierService typeFichierService = TypeFichierService.getInstance();
+
+    private final Set<TypeFichier> typeFichierSet = new HashSet<>();
+
+    @Override
+    public void initialize(URL location, ResourceBundle resources) {
+        keyToDecryptWithEye();
+        keyToDecryptField.setEditable(false);
+        keyConfirmationField.setEditable(false);
+        showKeyTextField.setEditable(false);
+
+        protegeCheckBox.selectedProperty().bindBidirectional(keyToDecryptField.editableProperty());
+        protegeCheckBox.selectedProperty().bindBidirectional(keyConfirmationField.editableProperty());
+        protegeCheckBox.selectedProperty().bindBidirectional(showKeyTextField.editableProperty());
+
+        typeFichierAbstractSelectItem.setTitle("Choix du type de fichier");
+        typeFichierAbstractSelectItem.setColumns(Arrays.asList(
+                TypeFichierTable.codeColumn(),
+                TypeFichierTable.libelleColumn()
+        ));
+        typeFichierAbstractSelectItem.setSearchFieldPairs(Arrays.asList(
+                new Pair<>("code", "Code"),
+                new Pair<>("libelle", "Libellé")
+        ));
+        initElements();
+    }
+
+    @FXML
+    void eyeOnMousePressed(MouseEvent event) {
+        if (passwordVisible) {
+            showKeyTextField.setVisible(false);
+            keyToDecryptField.setVisible(true);
+            passwordVisible = false;
+        } else {
+            keyToDecryptField.setVisible(false);
+            showKeyTextField.setVisible(true);
+            passwordVisible = true;
+        }
+    }
+
+    private void keyToDecryptWithEye() {
+        passwordVisible = false;
+        keyToDecryptField.textProperty().bindBidirectional(showKeyTextField.textProperty());
+        showKeyTextField.setVisible(false);
+        keyToDecryptField.setVisible(true);
+    }
+
+    private void initElements() {
+        Task<Void> task = new Task() {
+            @Override
+            protected Object call() throws Exception {
+                typeFichierSet.clear();
+                typeFichierSet.addAll(typeFichierService.getAllTypeFichWithoutValidateur());
+                return null;
+            }
+        };
+        task.setOnRunning(e -> LoadinIndicatorDialogUtil.getLoadingIndicatorDialog().show());
+        task.setOnSucceeded(e -> {
+            LoadinIndicatorDialogUtil.getLoadingIndicatorDialog().hide();
+            typeFichierAbstractSelectItem.setElements(typeFichierSet);
+        });
+        task.setOnFailed(e -> {
+            LoadinIndicatorDialogUtil.getLoadingIndicatorDialog().hide();
+            AlertMessageUtil.showAlertException(task.getException(),
+                    "Une exception s'est produite pendant le traitement", "Erreur");
+        });
+        Thread thread = new Thread(task);
+        thread.setDaemon(true);
+        thread.start();
+    }
+
+    public PasswordField getKeyToDecryptField() {
+        return keyToDecryptField;
+    }
+
+    public PasswordField getKeyConfirmationField() {
+        return keyConfirmationField;
+    }
+
+    public CheckBox getProtegeCheckBox() {
+        return protegeCheckBox;
+    }
+
+}

--
Gitblit v1.10.0