OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 57 | 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.customerrelationship.customer.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.ui.DefaultGridBagConstraints;
20
 
21
import java.awt.GridBagConstraints;
22
import java.awt.GridBagLayout;
23
import java.util.ArrayList;
24
import java.util.List;
25
 
26
import javax.swing.JLabel;
27
import javax.swing.JTextArea;
28
import javax.swing.JTextField;
29
 
30
public class ModeleCourrierClientSQLElement extends ComptaSQLConfElement {
31
 
32
    public ModeleCourrierClientSQLElement() {
33
        super("MODELE_COURRIER_CLIENT", "un modéle de courrier", "modéles de courriers");
34
    }
35
 
36
    protected List<String> getListFields() {
37
        final List<String> l = new ArrayList<String>();
38
        l.add("NOM");
39
        l.add("CONTENU");
40
        return l;
41
    }
42
 
43
    protected List<String> getComboFields() {
44
        final List<String> l = new ArrayList<String>();
45
        l.add("NOM");
46
        return l;
47
    }
48
 
49
    /*
50
     * (non-Javadoc)
51
     *
52
     * @see org.openconcerto.devis.SQLElement#getComponent()
53
     */
54
    public SQLComponent createComponent() {
55
        return new BaseSQLComponent(this) {
56
 
57
            JTextField textNom = new JTextField();
58
            JTextArea textContenu = new JTextArea();
59
 
60
            public void addViews() {
61
                GridBagConstraints c = new DefaultGridBagConstraints();
62
 
63
                this.setLayout(new GridBagLayout());
64
 
65
                // Numéro
66
                this.add(new JLabel(getLabelFor("NOM")), c);
67
                c.gridx++;
68
                c.weightx = 1;
69
                this.add(this.textNom, c);
70
 
71
                // Infos
72
                c.gridx = 0;
73
                c.gridy++;
74
                c.weightx = 0;
75
                c.anchor = GridBagConstraints.NORTHWEST;
76
                this.add(new JLabel(getLabelFor("CONTENU")), c);
77
                c.gridx++;
78
                c.weightx = 1;
79
                c.fill = GridBagConstraints.BOTH;
80
                c.weighty = 1;
81
                this.add(textContenu, c);
82
 
83
                this.addRequiredSQLObject(this.textNom, "NOM");
84
                this.addSQLObject(this.textContenu, "CONTENU");
85
            }
86
        };
87
    }
57 ilm 88
 
89
    @Override
90
    protected String createCode() {
156 ilm 91
        return this.createCodeOfPackage() + ".mailtemplate";
57 ilm 92
    }
18 ilm 93
}