OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 73 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 73 Rev 80
Line 19... Line 19...
19
import org.openconcerto.erp.element.objet.Compte;
19
import org.openconcerto.erp.element.objet.Compte;
20
import org.openconcerto.sql.Configuration;
20
import org.openconcerto.sql.Configuration;
21
import org.openconcerto.sql.element.SQLElement;
21
import org.openconcerto.sql.element.SQLElement;
22
import org.openconcerto.sql.model.SQLRow;
22
import org.openconcerto.sql.model.SQLRow;
23
import org.openconcerto.sql.model.SQLTable;
23
import org.openconcerto.sql.model.SQLTable;
-
 
24
import org.openconcerto.sql.model.SQLTableEvent;
24
import org.openconcerto.sql.model.SQLTableListener;
25
import org.openconcerto.sql.model.SQLTableListener;
-
 
26
import org.openconcerto.sql.model.SQLTableModifiedListener;
25
import org.openconcerto.sql.view.EditFrame;
27
import org.openconcerto.sql.view.EditFrame;
26
import org.openconcerto.ui.DefaultGridBagConstraints;
28
import org.openconcerto.ui.DefaultGridBagConstraints;
27
import org.openconcerto.utils.ExceptionHandler;
29
import org.openconcerto.utils.ExceptionHandler;
28
 
30
 
29
import java.awt.Container;
31
import java.awt.Container;
Line 39... Line 41...
39
import javax.swing.JFrame;
41
import javax.swing.JFrame;
40
import javax.swing.JTable;
42
import javax.swing.JTable;
41
 
43
 
42
public class GestionPlanComptableEFrame extends JFrame {
44
public class GestionPlanComptableEFrame extends JFrame {
43
 
45
 
44
    private JButton boutonAjout = new JButton("Ajout");
46
    private JButton boutonAjout = new JButton("Créer un nouveau compte");
45
    private JButton boutonSuppr = new JButton("Supprimer");
47
    private JButton boutonSuppr = new JButton("Supprimer");
46
    private JButton boutonAjoutPCG = new JButton("Ajout depuis le PCG");
48
    private JButton boutonAjoutPCG = new JButton("Ajouter un compte depuis le PCG");
47
    private EditFrame edit = null;
49
    private EditFrame edit = null;
48
    private AjouterComptePCGtoPCEFrame ajoutCptFrame = null;
50
    private AjouterComptePCGtoPCEFrame ajoutCptFrame = null;
49
 
51
 
50
    private SQLTable compteTable = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getTable("COMPTE_PCE");
52
    private SQLTable compteTable = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getTable("COMPTE_PCE");
51
    private PlanComptableEPanel panelPCE;
53
    private PlanComptableEPanel panelPCE;
Line 70... Line 72...
70
 
72
 
71
        this.panelPCE = new PlanComptableEPanel(actionClickDroitTable);
73
        this.panelPCE = new PlanComptableEPanel(actionClickDroitTable);
72
 
74
 
73
        container.setLayout(new GridBagLayout());
75
        container.setLayout(new GridBagLayout());
74
        final GridBagConstraints c = new DefaultGridBagConstraints();
76
        final GridBagConstraints c = new DefaultGridBagConstraints();
75
 
-
 
-
 
77
        c.fill = GridBagConstraints.NONE;
76
        container.add(this.boutonAjout, c);
78
        container.add(this.boutonAjout, c);
77
 
79
 
78
        this.boutonAjout.addActionListener(new ActionListener() {
80
        this.boutonAjout.addActionListener(new ActionListener() {
79
 
81
 
80
            public void actionPerformed(ActionEvent e) {
82
            public void actionPerformed(ActionEvent e) {
Line 93... Line 95...
93
                supprimerCompte();
95
                supprimerCompte();
94
            }
96
            }
95
        });
97
        });
96
 
98
 
97
        c.gridx++;
99
        c.gridx++;
98
        container.add(this.boutonAjoutPCG);
100
        container.add(this.boutonAjoutPCG, c);
99
        this.boutonAjoutPCG.addActionListener(new ActionListener() {
101
        this.boutonAjoutPCG.addActionListener(new ActionListener() {
100
 
102
 
101
            public void actionPerformed(ActionEvent e) {
103
            public void actionPerformed(ActionEvent e) {
102
                if (GestionPlanComptableEFrame.this.ajoutCptFrame == null) {
104
                if (GestionPlanComptableEFrame.this.ajoutCptFrame == null) {
103
                    GestionPlanComptableEFrame.this.ajoutCptFrame = new AjouterComptePCGtoPCEFrame();
105
                    GestionPlanComptableEFrame.this.ajoutCptFrame = new AjouterComptePCGtoPCEFrame();
Line 114... Line 116...
114
        c.weightx = 1;
116
        c.weightx = 1;
115
        c.weighty = 1;
117
        c.weighty = 1;
116
 
118
 
117
        container.add(this.panelPCE, c);
119
        container.add(this.panelPCE, c);
118
 
120
 
119
        this.compteTable.addTableListener(new SQLTableListener() {
121
        this.compteTable.addTableModifiedListener(new SQLTableModifiedListener() {
120
 
-
 
121
            public void rowModified(SQLTable table, int id) {
-
 
122
 
-
 
123
                SQLRow row = table.getRow(id);
-
 
124
                GestionPlanComptableEFrame.this.panelPCE.fireModificationCompte(new Compte(id, row.getString("NUMERO"), row.getString("NOM")));
-
 
125
            }
-
 
126
 
-
 
127
            public void rowAdded(SQLTable table, int id) {
-
 
128
 
-
 
129
                SQLRow row = table.getRow(id);
-
 
130
                GestionPlanComptableEFrame.this.panelPCE.fireModificationCompte(new Compte(id, row.getString("NUMERO"), row.getString("NOM")));
-
 
131
            }
-
 
132
 
-
 
133
            public void rowDeleted(SQLTable table, int id) {
-
 
134
 
122
 
-
 
123
            @Override
-
 
124
            public void tableModified(SQLTableEvent evt) {
135
                SQLRow row = table.getRow(id);
125
                final SQLRow row = evt.getRow();
136
                GestionPlanComptableEFrame.this.panelPCE.fireModificationCompte(new Compte(id, row.getString("NUMERO"), row.getString("NOM")));
126
                GestionPlanComptableEFrame.this.panelPCE.fireModificationCompte(new Compte(evt.getId(), row.getString("NUMERO"), row.getString("NOM")));
137
            }
127
            }
138
        });
128
        });
139
    }
129
    }
140
 
130
 
141
    private void supprimerCompte() {
131
    private void supprimerCompte() {