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/SubObjectEditFormController.java | 206 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 206 insertions(+), 0 deletions(-)
diff --git a/fdx_convert/src/main/java/com/megatim/fdxconvert/forms/SubObjectEditFormController.java b/fdx_convert/src/main/java/com/megatim/fdxconvert/forms/SubObjectEditFormController.java
new file mode 100644
index 0000000..638a80b
--- /dev/null
+++ b/fdx_convert/src/main/java/com/megatim/fdxconvert/forms/SubObjectEditFormController.java
@@ -0,0 +1,206 @@
+/*
+ * 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.abstracts.AbstractEditDialogController;
+import com.megatimfx.common.abstracts.context.AbstractViewContext;
+import com.megatimfx.common.annontations.Champ;
+import com.megatimfx.common.enums.TypeOperation;
+import com.megatim.fdxconvert.controller.MainController;
+import com.megatim.fdxconvert.controller.StructureChampJsonEditDialogController;
+import com.megatim.fdxconvert.model.StructureChampJson;
+import com.megatim.fdxconvert.model.SubObject;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javafx.beans.property.Property;
+import javafx.beans.property.SimpleObjectProperty;
+import javafx.beans.property.SimpleStringProperty;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.event.Event;
+import javafx.fxml.FXML;
+import javafx.fxml.FXMLLoader;
+import javafx.fxml.Initializable;
+import javafx.scene.Node;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TableRow;
+import javafx.scene.control.TableView;
+import javafx.scene.control.TextField;
+import javafx.scene.control.cell.PropertyValueFactory;
+import javafx.stage.Modality;
+import javafx.stage.Stage;
+import javafx.stage.StageStyle;
+
+/**
+ *
+ * @author ASUS
+ */
+public class SubObjectEditFormController implements Initializable {
+
+ @FXML
+ @Champ(mappedBy = "subObjectName")
+ private TextField subObjectNameTextField;
+
+ @FXML
+ private Button addFieldButton;
+
+ @FXML
+ private Button updateFieldButton;
+
+ @FXML
+ private Button deleteFieldButton;
+
+ @FXML
+ private TableColumn<StructureChampJson, String> fieldNameTableColumn;
+
+ @FXML
+ private TableColumn<StructureChampJson, String> dataTypeTableColumn;
+
+ @FXML
+ private TableColumn<StructureChampJson, String> isListeTableColumn;
+
+ @FXML
+ private TableColumn<StructureChampJson, String> formatDateTableColumn;
+
+ @FXML
+ private TableColumn<StructureChampJson, String> separateurDateTableColumn;
+
+ @FXML
+ private TableView subObjectsFieldsTableView;
+
+ private ObservableList<StructureChampJson> subStructureJsonListe = FXCollections.observableArrayList();
+
+ private Property<ObservableList<StructureChampJson>> subChampListeProperty = new SimpleObjectProperty<>(subStructureJsonListe);
+
+ private ObservableList<SubObject> currentSubObjectsListe;
+
+ @Override
+ public void initialize(URL url, ResourceBundle rb) {
+ initSubObjectsFieldsTableView();
+
+ subObjectNameTextField.setText("");
+
+ addFieldButton.setOnMouseClicked(event -> {
+ openStructureChampJsonDialog(event, new StructureChampJson(), TypeOperation.ADD);
+ });
+
+ updateFieldButton.setOnMouseClicked(event -> {
+ updateStructureJson(event);
+ });
+
+ subObjectsFieldsTableView.setRowFactory(rf -> {
+
+ TableRow<StructureChampJson> row = new TableRow<>();
+ row.setOnMouseClicked(event -> {
+ if (event.getClickCount() == 2 && (!row.isEmpty())) {
+ StructureChampJson rowData = row.getItem();
+ openStructureChampJsonDialog(event, rowData, TypeOperation.VIEW);
+ }
+ });
+
+ return row;
+ });
+ }
+
+ public ObservableList<StructureChampJson> getSubStructureJsonListe() {
+ return subStructureJsonListe;
+ }
+
+ public void setCurrentSubObjectsListe(ObservableList<SubObject> currentSubObjectsListe) {
+ this.currentSubObjectsListe = currentSubObjectsListe;
+ }
+
+ public TextField getSubObjectNameTextField() {
+ return subObjectNameTextField;
+ }
+
+ public Button getAddFieldButton() {
+ return addFieldButton;
+ }
+
+ public Button getUpdateFieldButton() {
+ return updateFieldButton;
+ }
+
+ public Button getDeleteFieldButton() {
+ return deleteFieldButton;
+ }
+
+ public TableView getSubObjectsFieldsTableView() {
+ return subObjectsFieldsTableView;
+ }
+
+ private void initSubObjectsFieldsTableView() {
+ subObjectsFieldsTableView.itemsProperty().bind(subChampListeProperty);
+
+ separateurDateTableColumn.setCellValueFactory(new PropertyValueFactory("delimiteurDate"));
+ formatDateTableColumn.setCellValueFactory(new PropertyValueFactory("formatDate"));
+ isListeTableColumn.setCellValueFactory(c -> {
+ if (c.getValue().isListe()) {
+ return new SimpleStringProperty("Oui");
+ } else {
+ return new SimpleStringProperty("Non");
+ }
+ });
+ dataTypeTableColumn.setCellValueFactory(new PropertyValueFactory("typeDonnee"));
+ fieldNameTableColumn.setCellValueFactory(new PropertyValueFactory("libelle"));
+
+ }
+
+
+ private void updateStructureJson(Event event) {
+ Object selectedItem = subObjectsFieldsTableView.getSelectionModel().getSelectedItem();
+
+ if (selectedItem != null) {
+
+ StructureChampJson structureToBeUpdated = (StructureChampJson) selectedItem;
+ openStructureChampJsonDialog(event, structureToBeUpdated, TypeOperation.UPDATE);
+ }
+ }
+
+ private void openStructureChampJsonDialog(Event event, StructureChampJson structureJson, TypeOperation typeOperation) {
+ try {
+
+ FXMLLoader loader = new FXMLLoader(
+ (AbstractViewContext.getInstance().getAbstractEditDialogControllerURL() == null)
+ ? AbstractEditDialogController.class.getResource("AbstractEditDialog.fxml")
+ : AbstractViewContext.getInstance().getAbstractEditDialogControllerURL()
+ );
+ StructureChampJsonEditDialogController controller = new StructureChampJsonEditDialogController();
+ controller.setSubObjectEditFormController(this);
+ controller.setSubObjectsList(currentSubObjectsListe);
+
+ loader.setControllerFactory(param -> controller);
+
+ Parent root = loader.load();
+ Node source = (Node) event.getSource();
+
+ Stage parentStage = (Stage) source.getScene().getWindow();
+
+ controller.initData(parentStage, typeOperation, structureJson, null,
+ subStructureJsonListe, true);
+
+ setStage(root);
+ } catch (IOException ex) {
+ Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
+ }
+ }
+
+ private void setStage(Parent root) {
+ Scene scene = new Scene(root);
+ Stage stage = new Stage();
+
+ stage.setScene(scene);
+ stage.initStyle(StageStyle.UNDECORATED);
+ stage.initModality(Modality.APPLICATION_MODAL);
+ stage.show();
+ }
+}
--
Gitblit v1.10.0