OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

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