OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 144 | Details | Compare with Previous | 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.common.element;
15
 
16
import org.openconcerto.sql.element.BaseSQLComponent;
17
import org.openconcerto.sql.element.SQLComponent;
18
import org.openconcerto.ui.DefaultGridBagConstraints;
144 ilm 19
import org.openconcerto.utils.ListMap;
19 ilm 20
 
21
import java.awt.GridBagConstraints;
22
import java.awt.GridBagLayout;
23
import java.util.ArrayList;
24
import java.util.List;
25
 
26
import javax.swing.JLabel;
27
import javax.swing.JTextField;
28
 
29
public class LangueSQLElement extends ComptaSQLConfElement {
30
 
31
    public LangueSQLElement() {
156 ilm 32
        super("LANGUE", "une langue", "langues");
19 ilm 33
    }
34
 
35
    protected List<String> getListFields() {
36
        final List<String> l = new ArrayList<String>();
37
        l.add("NOM");
38
        return l;
39
    }
40
 
41
    protected List<String> getComboFields() {
42
        final List<String> l = new ArrayList<String>();
43
        l.add("NOM");
44
        return l;
45
    }
46
 
144 ilm 47
    @Override
48
    public ListMap<String, String> getShowAs() {
49
        ListMap<String, String> map = new ListMap<String, String>();
50
        map.add(null, "NOM");
51
        return map;
52
    }
53
 
19 ilm 54
    /*
55
     * (non-Javadoc)
56
     *
57
     * @see org.openconcerto.devis.SQLElement#getComponent()
58
     */
59
    public SQLComponent createComponent() {
60
        return new BaseSQLComponent(this) {
61
            public void addViews() {
62
                this.setLayout(new GridBagLayout());
63
                final GridBagConstraints c = new DefaultGridBagConstraints();
64
                c.gridx = GridBagConstraints.RELATIVE;
65
                final JTextField textNom = new JTextField();
66
                final JTextField textChemin = new JTextField();
67
                final JLabel labelNom = new JLabel(getLabelFor("NOM"));
68
                final JLabel labelChemin = new JLabel(getLabelFor("CHEMIN"));
69
                this.add(labelNom, c);
70
                c.weightx = 0.5;
71
                this.add(textNom, c);
72
                c.weightx = 0;
73
                this.add(labelChemin, c);
74
                c.weightx = 0.5;
75
                this.add(textChemin, c);
76
 
77
                this.addSQLObject(textChemin, "CHEMIN");
78
                this.addSQLObject(textNom, "NOM");
79
            }
80
        };
81
    }
57 ilm 82
 
83
    @Override
84
    protected String createCode() {
85
        return "language";
86
    }
19 ilm 87
}