OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
156 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.sales.product.element;
15
 
16
import org.openconcerto.sql.element.BaseSQLComponent;
17
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
18
import org.openconcerto.sql.element.SQLComponent;
19
import org.openconcerto.sql.sqlobject.ElementComboBox;
20
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
21
import org.openconcerto.ui.DefaultGridBagConstraints;
22
import org.openconcerto.utils.ListMap;
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 CoutRevientSQLElement extends ComptaSQLConfElement {
33
 
34
    public CoutRevientSQLElement() {
35
        super("COUT_REVIENT");
36
    }
37
 
38
    protected List<String> getListFields() {
39
        final List<String> list = new ArrayList<String>(2);
40
        list.add("CODE");
41
        list.add("NOM");
42
        list.add("POURCENT");
43
        return list;
44
    }
45
 
46
    protected List<String> getComboFields() {
47
        final List<String> list = new ArrayList<String>(2);
48
        list.add("CODE");
49
        list.add("NOM");
50
        list.add("POURCENT");
51
        return list;
52
    }
53
 
54
    @Override
55
    public ListMap<String, String> getShowAs() {
56
        return ListMap.singleton(null, "CODE");
57
 
58
    }
59
 
60
    public SQLComponent createComponent() {
61
        return new BaseSQLComponent(this) {
62
 
63
            public void addViews() {
64
                this.setLayout(new GridBagLayout());
65
                final GridBagConstraints c = new DefaultGridBagConstraints();
66
 
67
                // Code
68
                final JLabel labelCode = new JLabel(getLabelFor("CODE"));
69
                c.weightx = 0;
70
                this.add(labelCode, c);
71
                c.gridx++;
72
                c.weightx = 1;
73
                final JTextField textCode = new JTextField();
74
                this.add(textCode, c);
75
 
76
                // Nom
77
                c.gridx++;
78
                c.weightx = 0;
79
                final JLabel labelNom = new JLabel(getLabelFor("NOM"));
80
                this.add(labelNom, c);
81
                c.gridx++;
82
                c.weightx = 1;
83
                final JTextField textNom = new JTextField();
84
                this.add(textNom, c);
85
 
86
                // Famille
87
                c.gridy++;
88
                c.gridx = 0;
89
                c.weightx = 0;
90
 
91
                final JLabel labelTaux = new JLabel(getLabelFor("POURCENT"));
92
                this.add(labelTaux, c);
93
                c.gridx++;
94
                c.weightx = 1;
95
                final JTextField textTaux = new JTextField();
96
                this.add(textTaux, c);
97
 
98
                this.addRequiredSQLObject(textTaux, "POURCENT");
99
                this.addRequiredSQLObject(textNom, "NOM");
100
                this.addRequiredSQLObject(textCode, "CODE");
101
            }
102
        };
103
    }
104
}