/* * 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.controller; import com.megatimfx.common.abstracts.AbstractEditDialogController; import com.megatimfx.common.enums.TypeOperation; import com.megatim.fdxconvert.forms.JournalEditFormController; import com.megatim.fdxconvert.model.Journal; import java.io.IOException; import java.math.BigDecimal; import java.net.URL; import java.text.NumberFormat; import java.util.ResourceBundle; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.layout.Pane; /** * * @author ASUS */ public class JournalEditDialogController extends AbstractEditDialogController { private JournalEditFormController journalEditFormController; @Override public void initialize(URL url, ResourceBundle rb) { journalEditFormController = new JournalEditFormController(); super.initialize(url, rb); } @Override public String getTitle() { return "Visualiser le journal des actions"; } @Override public Pane getContentFormPane() throws IOException { FXMLLoader loader = new FXMLLoader(JournalEditFormController.class.getResource("JournalEditForm.fxml")); loader.setControllerFactory(param -> journalEditFormController); Parent parent = loader.load(); return (Pane) parent; } @Override public Object getContentFormController() { return journalEditFormController; } @Override protected void afterBindFormFieldWithCurrentObject(Journal bindObject, Object formController, TypeOperation typeOperation) { if (formController instanceof JournalEditFormController) { JournalEditFormController controller = (JournalEditFormController) formController; if (typeOperation.equals(TypeOperation.VIEW)) { controller.getNombreLignesTextfield().setText(separateurMillier(bindObject.getNombreLignes())); } } } private String separateurMillier(Long value) { NumberFormat numberFormat = NumberFormat.getInstance(java.util.Locale.FRENCH); return (numberFormat.format(value)); } }