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.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.SwingConstants;
29
 
30
public class ArticleCatComptableSQLElement extends ComptaSQLConfElement {
31
 
32
    public ArticleCatComptableSQLElement() {
33
        super("ARTICLE_CATEGORIE_COMPTABLE", "une liaison article catégorie comptable", "liaisons article catégorie comptable");
34
    }
35
 
36
    protected List<String> getListFields() {
37
        final List<String> l = new ArrayList<String>();
38
        l.add("ID_ARTICLE");
39
        l.add("ID_CATEGORIE_COMPTABLE");
40
        l.add("ID_COMPTE_PCE_VENTE");
41
        l.add("ID_COMPTE_PCE_ACHAT");
42
        l.add("ID_TAXE");
43
        return l;
44
    }
45
 
46
    protected List<String> getComboFields() {
47
        final List<String> l = new ArrayList<String>();
48
        l.add("ID_ARTICLE");
49
        l.add("ID_CATEGORIE_COMPTABLE");
50
        return l;
51
    }
52
 
53
    @Override
54
    protected String getParentFFName() {
55
        return "ID_ARTICLE";
56
    }
57
 
58
    /*
59
     * (non-Javadoc)
60
     *
61
     * @see org.openconcerto.devis.SQLElement#getComponent()
62
     */
63
    public SQLComponent createComponent() {
64
        return new BaseSQLComponent(this) {
65
            public void addViews() {
66
                this.setLayout(new GridBagLayout());
67
                final GridBagConstraints c = new DefaultGridBagConstraints();
68
 
69
                // Famille père
70
                final JLabel labelLangue = new JLabel(getLabelFor("ID_ARTICLE"), SwingConstants.RIGHT);
71
                c.gridx = 0;
72
                c.gridy++;
73
                c.weightx = 0;
74
                this.add(labelLangue, c);
75
 
76
                final ElementComboBox artBox = new ElementComboBox(true, 25);
77
                DefaultGridBagConstraints.lockMinimumSize(artBox);
78
                c.gridx++;
79
                c.weightx = 1;
80
                this.add(artBox, c);
81
 
82
                this.addSQLObject(artBox, "ID_ARTICLE");
83
            }
84
 
85
        };
86
    }
87
 
88
    @Override
89
    protected String createCode() {
90
        return createCodeOfPackage() + ".compta";
91
    }
92
}