OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 142 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
142 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
 
156 ilm 16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
142 ilm 17
import org.openconcerto.sql.element.BaseSQLComponent;
18
import org.openconcerto.sql.element.SQLComponent;
156 ilm 19
import org.openconcerto.sql.model.DBRoot;
142 ilm 20
import org.openconcerto.ui.DefaultGridBagConstraints;
21
import org.openconcerto.utils.ListMap;
22
 
23
import java.awt.GridBagConstraints;
24
import java.awt.GridBagLayout;
25
import java.util.ArrayList;
26
import java.util.List;
27
 
28
import javax.swing.JLabel;
29
import javax.swing.JTextField;
30
 
156 ilm 31
public class FamilleEcoContributionSQLElement extends ComptaSQLConfElement {
142 ilm 32
 
156 ilm 33
    public FamilleEcoContributionSQLElement(final DBRoot root) {
34
        super(root.getTable("FAMILLE_ECO_CONTRIBUTION"));
142 ilm 35
    }
36
 
156 ilm 37
    @Override
38
    protected String createCode() {
39
        return this.createCodeOfPackage() + ".ewaste-family";
40
    }
41
 
142 ilm 42
    protected List<String> getListFields() {
43
        final List<String> list = new ArrayList<String>(2);
44
        list.add("NOM");
45
        return list;
46
    }
47
 
48
    protected List<String> getComboFields() {
49
        final List<String> list = new ArrayList<String>(2);
50
        list.add("NOM");
51
        return list;
52
    }
53
 
54
    @Override
55
    public ListMap<String, String> getShowAs() {
56
        ListMap<String, String> map = new ListMap<String, String>();
57
        map.add(null, "NOM");
58
        return map;
59
    }
60
 
61
    public SQLComponent createComponent() {
62
        return new BaseSQLComponent(this) {
63
 
64
            public void addViews() {
65
                this.setLayout(new GridBagLayout());
66
                final GridBagConstraints c = new DefaultGridBagConstraints();
67
 
68
                // Nom
69
                c.gridx++;
70
                c.weightx = 0;
71
                final JLabel labelNom = new JLabel(getLabelFor("NOM"));
72
                this.add(labelNom, c);
73
                c.gridx++;
74
                c.weightx = 1;
75
                final JTextField textNom = new JTextField();
76
                this.add(textNom, c);
77
 
78
                this.addRequiredSQLObject(textNom, "NOM");
79
            }
80
        };
81
    }
82
}