OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 132 | 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.finance.accounting.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;
132 ilm 19
import org.openconcerto.utils.ListMap;
18 ilm 20
 
21
import java.util.ArrayList;
22
import java.util.List;
23
 
24
import javax.swing.JLabel;
19 ilm 25
import javax.swing.JTextField;
18 ilm 26
 
27
/***************************************************************************************************
28
 * Une pièce regroupe l'ensemble d'une opération comptable c'est un ensemble de mouvement
29
 **************************************************************************************************/
30
public class PieceSQLElement extends ComptaSQLConfElement {
31
 
32
    private static final String NOM = "NOM";
33
 
34
    public PieceSQLElement() {
35
        super("PIECE", "une pièce comptable", "pièces comptables");
36
    }
37
 
38
    protected List<String> getComboFields() {
39
        final List<String> list = new ArrayList<String>(1);
40
        list.add(NOM);
41
        return list;
42
    }
43
 
44
    protected List<String> getListFields() {
45
        final List<String> list = new ArrayList<String>(1);
46
        list.add(NOM);
47
        return list;
48
    }
49
 
73 ilm 50
    @Override
132 ilm 51
    public ListMap<String, String> getShowAs() {
52
        final ListMap<String, String> res = new ListMap<String, String>();
53
        res.putCollection(null, "NOM");
73 ilm 54
        return res;
55
    }
56
 
18 ilm 57
    public SQLComponent createComponent() {
58
        return new BaseSQLComponent(this) {
59
            public void addViews() {
60
                final JLabel labelNom = new JLabel(getLabelFor(NOM));
61
                this.add(labelNom);
62
                final JTextField piece = new JTextField();
63
                this.add(piece);
64
                this.addSQLObject(piece, NOM);
65
            }
66
        };
67
    }
57 ilm 68
 
69
    @Override
70
    protected String createCode() {
156 ilm 71
        return createCodeOfPackage() + ".piece";
57 ilm 72
    }
18 ilm 73
}