OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 57 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
18 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
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
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.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.erp.core.supplychain.supplier.element;
15
 
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
17
import org.openconcerto.erp.core.common.ui.DeviseField;
18
import org.openconcerto.sql.element.BaseSQLComponent;
19
import org.openconcerto.sql.element.SQLComponent;
20
import org.openconcerto.sql.sqlobject.ElementComboBox;
21
import org.openconcerto.ui.DefaultGridBagConstraints;
22
import org.openconcerto.ui.JDate;
23
 
24
import java.awt.GridBagConstraints;
25
import java.awt.GridBagLayout;
26
import java.util.ArrayList;
27
import java.util.List;
28
 
29
import javax.swing.JLabel;
30
import javax.swing.JTextField;
31
 
32
public class EcheanceFournisseurSQLElement extends ComptaSQLConfElement {
33
 
34
    public EcheanceFournisseurSQLElement() {
35
        super("ECHEANCE_FOURNISSEUR", "une échéance fournisseur", "échéances fournisseurs");
36
    }
37
 
38
    protected List<String> getListFields() {
39
        final List<String> l = new ArrayList<String>();
40
 
41
        l.add("MONTANT");
42
        l.add("DATE");
43
        l.add("ID_MOUVEMENT");
44
        l.add("ID_FOURNISSEUR");
45
        return l;
46
    }
47
 
48
    protected List<String> getComboFields() {
49
        final List<String> l = new ArrayList<String>();
50
        l.add("DATE");
51
        l.add("ID_FOURNISSEUR");
52
        l.add("MONTANT");
53
        return l;
54
    }
55
 
56
    /*
57
     * (non-Javadoc)
58
     *
59
     * @see org.openconcerto.devis.SQLElement#getComponent()
60
     */
61
    public SQLComponent createComponent() {
62
        return new BaseSQLComponent(this) {
63
 
64
            private DeviseField montant;
65
            private JDate date;
66
            private JTextField idMouvement;
67
 
68
            public void addViews() {
69
                this.setLayout(new GridBagLayout());
70
                final GridBagConstraints c = new DefaultGridBagConstraints();
71
 
72
                this.montant = new DeviseField();
73
                this.date = new JDate();
74
                this.idMouvement = new JTextField();
75
                final ElementComboBox fournisseur = new ElementComboBox();
76
 
77
                // Mouvement
78
                JLabel labelMouvement = new JLabel("Mouvement");
79
                this.add(labelMouvement, c);
80
 
81
                c.weightx = 1;
82
                c.gridx++;
83
                this.add(this.idMouvement, c);
84
 
85
                // Date
86
                JLabel labelDate = new JLabel("Date");
87
                c.gridx++;
88
                this.add(labelDate, c);
89
 
90
                c.gridx++;
91
                c.weightx = 1;
92
                this.add(this.date, c);
93
 
94
                // Fournisseur
95
                JLabel labelFournisseur = new JLabel("Fournisseur");
96
                c.gridy++;
97
                c.gridx = 0;
98
 
99
                this.add(labelFournisseur, c);
100
 
101
                c.gridx++;
102
                c.weightx = 1;
103
                c.gridwidth = GridBagConstraints.REMAINDER;
104
                this.add(fournisseur, c);
105
 
106
                // montant
107
                c.gridwidth = 1;
108
                JLabel labelMontant = new JLabel("Montant");
109
                c.gridy++;
110
                c.gridx = 0;
111
                this.add(labelMontant, c);
112
 
113
                c.gridx++;
114
                c.weightx = 1;
115
                this.add(this.montant, c);
116
 
117
                this.addSQLObject(this.montant, "MONTANT");
118
                this.addSQLObject(this.date, "DATE");
119
                this.addRequiredSQLObject(fournisseur, "ID_FOURNISSEUR");
120
                this.addSQLObject(this.idMouvement, "ID_MOUVEMENT");
121
            }
122
        };
123
    }
124
 
125
}