OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
132 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.humanresources.payroll.element;
15
 
16
import java.awt.GridBagConstraints;
17
import java.awt.GridBagLayout;
18
import java.util.ArrayList;
19
import java.util.List;
20
 
21
import javax.swing.JLabel;
22
import javax.swing.JTextField;
23
import javax.swing.SwingConstants;
24
 
25
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
26
import org.openconcerto.sql.element.BaseSQLComponent;
27
import org.openconcerto.sql.element.SQLComponent;
28
import org.openconcerto.ui.DefaultGridBagConstraints;
29
 
30
public class CoefficientPrimeSQLElement extends ComptaSQLConfElement {
31
 
32
    public CoefficientPrimeSQLElement() {
33
        super("COEFF_PRIME", "un coefficient de prime", "coefficients de prime");
34
    }
35
 
36
    protected List<String> getListFields() {
37
        final List<String> l = new ArrayList<String>();
38
        l.add("PRIME_PERSO");
39
        l.add("PRIME_RECONSTRUCTION");
40
        l.add("PRIME_ANCIENNETE");
41
        l.add("PRIME_DEROULEMENT");
42
        return l;
43
    }
44
 
45
    protected List<String> getComboFields() {
46
        final List<String> l = new ArrayList<String>();
47
        l.add("PRIME_PERSO");
48
        l.add("PRIME_RECONSTRUCTION");
49
        l.add("PRIME_ANCIENNETE");
50
        l.add("PRIME_DEROULEMENT");
51
        return l;
52
    }
53
 
54
    @Override
55
    public boolean isPrivate() {
56
        return true;
57
    }
58
 
59
    /*
60
     * (non-Javadoc)
61
     *
62
     * @see org.openconcerto.devis.SQLElement#getComponent()
63
     */
64
    public SQLComponent createComponent() {
65
        return new BaseSQLComponent(this) {
66
 
67
            public void addViews() {
68
 
69
                this.setLayout(new GridBagLayout());
70
                GridBagConstraints c = new DefaultGridBagConstraints();
71
 
72
                // Perso
73
                JLabel labelPerso = new JLabel(getLabelFor("PRIME_PERSO"));
74
                labelPerso.setHorizontalAlignment(SwingConstants.RIGHT);
75
                JTextField textPerso = new JTextField();
76
 
77
                this.add(labelPerso, c);
78
                c.gridx++;
79
                c.weightx = 1;
80
                this.add(textPerso, c);
81
 
82
                // Reconst
83
                JLabel labelRecons = new JLabel(getLabelFor("PRIME_RECONSTRUCTION"));
84
                labelRecons.setHorizontalAlignment(SwingConstants.RIGHT);
85
                JTextField textRecons = new JTextField();
86
 
87
                c.gridx = 0;
88
                c.gridy++;
89
                c.weightx = 0;
90
                this.add(labelRecons, c);
91
                c.gridx++;
92
                c.weightx = 1;
93
                this.add(textRecons, c);
94
 
95
                // Ancien
96
                JLabel labelAncien = new JLabel(getLabelFor("PRIME_ANCIENNETE"));
97
                labelAncien.setHorizontalAlignment(SwingConstants.RIGHT);
98
                JTextField textAncien = new JTextField();
99
 
100
                c.gridx = 0;
101
                c.gridy++;
102
                c.weightx = 0;
103
                this.add(labelAncien, c);
104
                c.gridx++;
105
                c.weightx = 1;
106
                this.add(textAncien, c);
107
 
108
                // Deroulement
109
                JLabel labelDeroul = new JLabel(getLabelFor("PRIME_DEROULEMENT"));
110
                labelDeroul.setHorizontalAlignment(SwingConstants.RIGHT);
111
                JTextField textDeroul = new JTextField();
112
 
113
                c.gridx = 0;
114
                c.gridy++;
115
                c.weightx = 0;
116
                this.add(labelDeroul, c);
117
                c.gridx++;
118
                c.weightx = 1;
119
                this.add(textDeroul, c);
120
 
121
                this.addSQLObject(textDeroul, "PRIME_DEROULEMENT");
122
                this.addSQLObject(textPerso, "PRIME_PERSO");
123
                this.addSQLObject(textRecons, "PRIME_RECONSTRUCTION");
124
                this.addSQLObject(textAncien, "PRIME_ANCIENNETE");
125
            }
126
        };
127
 
128
    }
129
 
130
    @Override
131
    protected String createCode() {
132
        return createCodeFromPackage() + ".coeffPrime";
133
    }
134
}