OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 151 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 151 Rev 156
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
10
 * 
10
 * 
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.core.finance.payment.element;
14
 package org.openconcerto.erp.core.finance.payment.element;
15
 
15
 
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
17
import org.openconcerto.sql.element.BaseSQLComponent;
17
import org.openconcerto.sql.element.BaseSQLComponent;
18
import org.openconcerto.sql.element.SQLComponent;
18
import org.openconcerto.sql.element.SQLComponent;
19
import org.openconcerto.sql.sqlobject.ElementComboBox;
19
import org.openconcerto.sql.sqlobject.ElementComboBox;
20
import org.openconcerto.ui.DefaultGridBagConstraints;
20
import org.openconcerto.ui.DefaultGridBagConstraints;
21
 
21
 
22
import java.awt.GridBagConstraints;
22
import java.awt.GridBagConstraints;
23
import java.awt.GridBagLayout;
23
import java.awt.GridBagLayout;
24
import java.util.ArrayList;
24
import java.util.ArrayList;
25
import java.util.List;
25
import java.util.List;
26
 
26
 
27
import javax.swing.JLabel;
27
import javax.swing.JLabel;
28
import javax.swing.JTextField;
28
import javax.swing.JTextField;
29
import javax.swing.SwingConstants;
29
import javax.swing.SwingConstants;
30
 
30
 
31
public class TypeReglementSQLElement extends ComptaSQLConfElement {
31
public class TypeReglementSQLElement extends ComptaSQLConfElement {
32
 
32
 
33
    public static final int INVALID = -1;
33
    public static final int INVALID = -1;
34
    public static final int CHEQUE = 2;
34
    public static final int CHEQUE = 2;
35
    public static final int CB = 3;
35
    public static final int CB = 3;
36
    public static final int ESPECE = 4;
36
    public static final int ESPECE = 4;
37
    public static final int TRAITE = 5;
37
    public static final int TRAITE = 5;
38
    public static final int MULTIPLE = 6;
38
    public static final int MULTIPLE = 6;
39
    public static final int INDEFINI = 7;
39
    public static final int INDEFINI = 7;
40
    public static final int VIREMENT = 8;
40
    public static final int VIREMENT = 8;
41
    public static final int CESU = 9;
41
    public static final int CESU = 9;
42
    public static final int PRELEVEMENT = 10;
42
    public static final int PRELEVEMENT = 10;
43
 
43
 
44
    public TypeReglementSQLElement() {
44
    public TypeReglementSQLElement() {
45
        super("TYPE_REGLEMENT", "Type de règlement", "Type de règlement");
45
        super("TYPE_REGLEMENT", "un type de règlement", "types de règlement");
46
    }
46
    }
47
 
47
 
48
    protected List<String> getListFields() {
48
    protected List<String> getListFields() {
49
        final List<String> l = new ArrayList<String>();
49
        final List<String> l = new ArrayList<String>();
50
        l.add("NOM");
50
        l.add("NOM");
51
        l.add("ID_COMPTE_PCE_CLIENT");
51
        l.add("ID_COMPTE_PCE_CLIENT");
52
        l.add("ID_COMPTE_PCE_FOURN");
52
        l.add("ID_COMPTE_PCE_FOURN");
53
        return l;
53
        return l;
54
    }
54
    }
55
 
55
 
56
    protected List<String> getComboFields() {
56
    protected List<String> getComboFields() {
57
        final List<String> l = new ArrayList<String>();
57
        final List<String> l = new ArrayList<String>();
58
        l.add("NOM");
58
        l.add("NOM");
59
        return l;
59
        return l;
60
    }
60
    }
61
 
61
 
62
    /*
62
    /*
63
     * (non-Javadoc)
63
     * (non-Javadoc)
64
     * 
64
     * 
65
     * @see org.openconcerto.devis.SQLElement#getComponent()
65
     * @see org.openconcerto.devis.SQLElement#getComponent()
66
     */
66
     */
67
    public SQLComponent createComponent() {
67
    public SQLComponent createComponent() {
68
        return new BaseSQLComponent(this) {
68
        return new BaseSQLComponent(this) {
69
            private JTextField textNom;
69
            private JTextField textNom;
70
 
70
 
71
            public void addViews() {
71
            public void addViews() {
72
                this.setLayout(new GridBagLayout());
72
                this.setLayout(new GridBagLayout());
73
                final GridBagConstraints c = new DefaultGridBagConstraints();
73
                final GridBagConstraints c = new DefaultGridBagConstraints();
74
 
74
 
75
                // libellé
75
                // libellé
76
                JLabel labelNom = new JLabel("Libellé");
76
                JLabel labelNom = new JLabel("Libellé");
77
                this.add(labelNom, c);
77
                this.add(labelNom, c);
78
 
78
 
79
                c.gridx++;
79
                c.gridx++;
80
                c.weightx = 1;
80
                c.weightx = 1;
81
                this.textNom = new JTextField();
81
                this.textNom = new JTextField();
82
                this.add(this.textNom, c);
82
                this.add(this.textNom, c);
83
 
83
 
84
                // Choix compte client
84
                // Choix compte client
85
                final ElementComboBox numeroCompteClient = new ElementComboBox();
85
                final ElementComboBox numeroCompteClient = new ElementComboBox();
86
                JLabel labelCompteCli = new JLabel("Compte Client");
86
                JLabel labelCompteCli = new JLabel("Compte Client");
87
                c.gridy++;
87
                c.gridy++;
88
                c.gridx = 0;
88
                c.gridx = 0;
89
                c.weightx = 0;
89
                c.weightx = 0;
90
                labelCompteCli.setHorizontalAlignment(SwingConstants.RIGHT);
90
                labelCompteCli.setHorizontalAlignment(SwingConstants.RIGHT);
91
                this.add(labelCompteCli, c);
91
                this.add(labelCompteCli, c);
92
 
92
 
93
                c.gridx++;
93
                c.gridx++;
94
                this.add(numeroCompteClient, c);
94
                this.add(numeroCompteClient, c);
95
 
95
 
96
                // Choix compte
96
                // Choix compte
97
                final ElementComboBox numeroCompteFourn = new ElementComboBox();
97
                final ElementComboBox numeroCompteFourn = new ElementComboBox();
98
                JLabel labelCompteFourn = new JLabel("Compte Fournisseur");
98
                JLabel labelCompteFourn = new JLabel("Compte Fournisseur");
99
                c.gridy++;
99
                c.gridy++;
100
                c.gridx = 0;
100
                c.gridx = 0;
101
                c.weightx = 0;
101
                c.weightx = 0;
102
                labelCompteFourn.setHorizontalAlignment(SwingConstants.RIGHT);
102
                labelCompteFourn.setHorizontalAlignment(SwingConstants.RIGHT);
103
                this.add(labelCompteFourn, c);
103
                this.add(labelCompteFourn, c);
104
 
104
 
105
                c.gridx++;
105
                c.gridx++;
106
                this.add(numeroCompteFourn, c);
106
                this.add(numeroCompteFourn, c);
107
 
107
 
108
                this.addView(this.textNom, "NOM");
108
                this.addView(this.textNom, "NOM");
109
                this.addView(numeroCompteClient, "ID_COMPTE_PCE_CLIENT", REQ);
109
                this.addView(numeroCompteClient, "ID_COMPTE_PCE_CLIENT", REQ);
110
                this.addView(numeroCompteFourn, "ID_COMPTE_PCE_FOURN", REQ);
110
                this.addView(numeroCompteFourn, "ID_COMPTE_PCE_FOURN", REQ);
111
            }
111
            }
112
        };
112
        };
113
    }
113
    }
114
 
114
 
115
    @Override
115
    @Override
116
    protected String createCode() {
116
    protected String createCode() {
117
        return createCodeFromPackage() + ".type";
117
        return createCodeOfPackage() + ".type";
118
    }
118
    }
119
}
119
}