OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 132 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 132 Rev 156
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
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
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
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.
9
 * language governing permissions and limitations under the License.
10
 * 
10
 * 
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.core.humanresources.payroll.element;
14
 package org.openconcerto.erp.core.humanresources.payroll.element;
15
 
15
 
16
import org.openconcerto.sql.element.ConfSQLElement;
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
17
import org.openconcerto.sql.element.SQLComponent;
17
import org.openconcerto.sql.element.SQLComponent;
18
import org.openconcerto.sql.element.UISQLComponent;
18
import org.openconcerto.sql.element.UISQLComponent;
-
 
19
import org.openconcerto.sql.model.SQLTable;
19
import org.openconcerto.utils.ListMap;
20
import org.openconcerto.utils.ListMap;
20
 
21
 
21
import java.util.ArrayList;
22
import java.util.ArrayList;
22
import java.util.List;
23
import java.util.List;
23
 
24
 
24
import javax.swing.JTextField;
25
import javax.swing.JTextField;
25
 
26
 
26
public abstract class AbstractTypeRubriqueSQLElement extends ConfSQLElement {
27
public abstract class AbstractTypeRubriqueSQLElement extends ComptaSQLConfElement {
27
 
28
 
28
    private static final String NOM = "NOM";
29
    private static final String NOM = "NOM";
29
 
30
 
30
    public AbstractTypeRubriqueSQLElement(final String tableName, final String singular, final String plural) {
31
    public AbstractTypeRubriqueSQLElement(final SQLTable table, final String singular, final String plural) {
31
        super(tableName, singular, plural);
32
        super(table, singular, plural);
32
    }
33
    }
33
 
34
 
34
    public List<String> getListFields() {
35
    public List<String> getListFields() {
35
        final List<String> list = new ArrayList<String>();
36
        final List<String> list = new ArrayList<String>();
36
        list.add(NOM);
37
        list.add(NOM);
37
        return list;
38
        return list;
38
    }
39
    }
39
 
40
 
40
    protected List<String> getComboFields() {
41
    protected List<String> getComboFields() {
41
        final List<String> list = new ArrayList<String>();
42
        final List<String> list = new ArrayList<String>();
42
        list.add(NOM);
43
        list.add(NOM);
43
        return list;
44
        return list;
44
    }
45
    }
45
 
46
 
46
    @Override
47
    @Override
47
    public ListMap<String, String> getShowAs() {
48
    public ListMap<String, String> getShowAs() {
48
        return ListMap.singleton(null, NOM);
49
        return ListMap.singleton(null, NOM);
49
    }
50
    }
50
 
51
 
51
    /*
52
    /*
52
     * (non-Javadoc)
53
     * (non-Javadoc)
53
     * 
54
     * 
54
     * @see org.openconcerto.devis.SQLElement#getComponent()
55
     * @see org.openconcerto.devis.SQLElement#getComponent()
55
     */
56
     */
56
    public SQLComponent createComponent() {
57
    public SQLComponent createComponent() {
57
        return new UISQLComponent(this) {
58
        return new UISQLComponent(this) {
58
            public void addViews() {
59
            public void addViews() {
59
                this.addRequiredSQLObject(new JTextField(), NOM, "right");
60
                this.addRequiredSQLObject(new JTextField(), NOM, "right");
60
                this.addSQLObject(new JTextField(), NOM, "left");
61
                this.addSQLObject(new JTextField(), NOM, "left");
61
            }
62
            }
62
        };
63
        };
63
    }
64
    }
64
}
65
}