OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 18 | Details | Compare with Previous | 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.finance.tax.element;
15
 
16
import org.openconcerto.erp.core.common.ui.DeviseField;
17
import org.openconcerto.sql.element.BaseSQLComponent;
156 ilm 18
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
18 ilm 19
import org.openconcerto.sql.element.SQLComponent;
20
import org.openconcerto.ui.DefaultGridBagConstraints;
21
 
22
import java.awt.GridBagConstraints;
23
import java.awt.GridBagLayout;
24
import java.util.ArrayList;
25
import java.util.List;
26
 
27
import javax.swing.JLabel;
28
import javax.swing.JTextField;
29
 
156 ilm 30
public class EcoTaxeSQLElement extends ComptaSQLConfElement {
18 ilm 31
 
32
    public EcoTaxeSQLElement() {
33
        super("ECOTAXE", "une écotaxe", "écotaxes");
34
    }
35
 
36
    protected List<String> getListFields() {
37
        final List<String> l = new ArrayList<String>();
38
        l.add("NOM");
39
        l.add("MONTANT_HT");
40
        return l;
41
    }
42
 
43
    protected List<String> getComboFields() {
44
        final List<String> l = new ArrayList<String>();
45
        l.add("NOM");
46
        l.add("MONTANT_HT");
47
        return l;
48
    }
49
 
50
    /*
51
     * (non-Javadoc)
52
     *
53
     * @see org.openconcerto.devis.SQLElement#getComponent()
54
     */
55
    public SQLComponent createComponent() {
56
        return new BaseSQLComponent(this) {
57
 
58
            public void addViews() {
59
                this.setLayout(new GridBagLayout());
60
                final GridBagConstraints c = new DefaultGridBagConstraints();
61
                c.gridx = GridBagConstraints.RELATIVE;
62
 
63
                // Nom
64
                this.add(new JLabel(getLabelFor("NOM")), c);
65
                c.gridx++;
66
                JTextField nom = new JTextField();
67
                c.weightx = 1;
68
 
69
                this.add(nom, c);
70
 
71
                c.weightx = 0;
72
                c.gridx++;
73
                DeviseField montant = new DeviseField();
74
                this.add(new JLabel(getLabelFor("MONTANT_HT")), c);
75
                c.gridx++;
76
                this.add(montant, c);
77
 
78
                this.addView(montant, "MONTANT_HT");
79
                this.addView(nom, "NOM");
80
 
81
            }
82
 
83
        };
84
    }
85
}