OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 57 | 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.sales.product.element;
15
 
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
17
import org.openconcerto.sql.element.BaseSQLComponent;
18
import org.openconcerto.sql.element.SQLComponent;
19
import org.openconcerto.sql.sqlobject.SQLTextCombo;
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
 
30
public class MetriqueSQLElement extends ComptaSQLConfElement {
31
 
32
    public MetriqueSQLElement() {
33
        super("METRIQUE", "une métrique", "métriques");
34
    }
35
 
36
    protected List<String> getListFields() {
37
        final List<String> l = new ArrayList<String>();
38
        l.add("NOM");
39
        l.add("UNITE");
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("UNITE");
47
        return l;
48
    }
49
 
50
    /*
51
     * (non-Javadoc)
52
     *
53
     * @see org.openconcerto.devis.SQLElement#getComponent()
54
     */
55
    public SQLComponent createComponent() {
56
 
57
        return new BaseSQLComponent(this) {
58
 
59
            public void addViews() {
60
                this.setLayout(new GridBagLayout());
61
                final GridBagConstraints c = new DefaultGridBagConstraints();
62
 
63
                // Nom
64
                this.add(new JLabel(getLabelFor("NOM")), c);
65
                c.gridx++;
66
                final JTextField textNom = new JTextField();
67
                this.add(textNom, c);
68
 
69
                // Nom
70
                c.gridx++;
71
                this.add(new JLabel("exprimé en"), c);
72
                c.gridx++;
73
                final SQLTextCombo textUnite = new SQLTextCombo();
74
                this.add(textUnite, c);
75
                this.addRequiredSQLObject(textNom, "NOM");
76
                this.addRequiredSQLObject(textUnite, "UNITE");
77
            }
78
        };
79
    }
57 ilm 80
 
81
    @Override
82
    protected String createCode() {
156 ilm 83
        return createCodeOfPackage() + ".quantity";
57 ilm 84
    }
18 ilm 85
}