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
19 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.ElementComboBox;
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
import javax.swing.SwingConstants;
30
 
31
public class ArticleDesignationSQLElement extends ComptaSQLConfElement {
32
 
33
    public ArticleDesignationSQLElement() {
34
        super("ARTICLE_DESIGNATION", "une désignation d'article", "désignation d'articles");
35
    }
36
 
37
    protected List<String> getListFields() {
38
        final List<String> l = new ArrayList<String>();
39
        l.add("ID_ARTICLE");
40
        l.add("NOM");
41
        l.add("ID_LANGUE");
42
        return l;
43
    }
44
 
45
    protected List<String> getComboFields() {
46
        final List<String> l = new ArrayList<String>();
47
        l.add("NOM");
48
        l.add("ID_LANGUE");
49
        return l;
50
    }
51
 
52
    /*
53
     * (non-Javadoc)
54
     *
55
     * @see org.openconcerto.devis.SQLElement#getComponent()
56
     */
57
    public SQLComponent createComponent() {
58
        return new BaseSQLComponent(this) {
59
            public void addViews() {
60
                this.setLayout(new GridBagLayout());
61
                final GridBagConstraints c = new DefaultGridBagConstraints();
62
 
63
                // Nom
64
                final JLabel labelNom = new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT);
65
                c.gridx = 0;
66
                c.weightx = 0;
67
                this.add(labelNom, c);
68
 
69
                final JTextField textNom = new JTextField(15);
70
                c.gridx++;
71
                c.weightx = 1;
72
                DefaultGridBagConstraints.lockMinimumSize(textNom);
73
                this.add(textNom, c);
74
                this.addRequiredSQLObject(textNom, "NOM");
75
 
76
                // Famille père
77
                final JLabel labelLangue = new JLabel(getLabelFor("ID_LANGUE"), SwingConstants.RIGHT);
78
                c.gridx = 0;
79
                c.gridy++;
80
                c.weightx = 0;
81
                this.add(labelLangue, c);
82
 
83
                final ElementComboBox langueBox = new ElementComboBox(true, 25);
84
                DefaultGridBagConstraints.lockMinimumSize(langueBox);
85
                c.gridx++;
86
                c.weightx = 1;
87
                this.add(langueBox, c);
88
 
89
                this.addSQLObject(langueBox, "ID_LANGUE");
90
            }
91
 
92
        };
93
    }
94
 
95
}