Kenmegne
6 days ago 908e81dd173f380879d5fabeb5794d5b7a76df0e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * 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<Journal> {
 
    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));
    }
}