OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 140 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
140 ilm 1
package org.openconcerto.modules.customerrelationship.lead.call;
2
 
3
import java.awt.Dimension;
4
import java.util.ArrayList;
5
import java.util.List;
6
 
7
import javax.swing.JComponent;
8
import javax.swing.JLabel;
9
import javax.swing.JScrollPane;
10
 
11
import org.openconcerto.erp.modules.AbstractModule;
12
import org.openconcerto.erp.modules.ModuleElement;
13
import org.openconcerto.modules.customerrelationship.lead.GroupSQLComponentWithService;
14
import org.openconcerto.sql.element.SQLComponent;
15
import org.openconcerto.ui.JDate;
16
import org.openconcerto.ui.JLabelBold;
181 ilm 17
import org.openconcerto.ui.component.ITextArea;
140 ilm 18
 
19
public class LeadCallSQLElement extends ModuleElement {
20
 
21
    public LeadCallSQLElement(AbstractModule module) {
22
        super(module, "LEAD_CALL");
23
    }
24
 
25
    @Override
26
    protected List<String> getListFields() {
27
        final List<String> l = new ArrayList<String>();
28
        l.add("DATE");
29
        l.add("ID_LEAD");
181 ilm 30
        l.add("INFORMATION");
31
        if (getTable().contains("ID_COMMERCIAL")) {
32
            l.add("ID_COMMERCIAL");
33
        }
34
 
140 ilm 35
        return l;
36
    }
37
 
38
    @Override
39
    protected List<String> getComboFields() {
40
        final List<String> l = new ArrayList<String>();
41
        l.add("DATE");
42
        l.add("ID_LEAD");
43
        return l;
44
    }
45
 
46
    @Override
47
    public SQLComponent createComponent() {
48
        return new GroupSQLComponentWithService(this, new LeadCallGroup()) {
49
            @Override
50
            public JComponent getLabel(String id) {
51
                if (id.equals("customerrelationship.lead.call.content")) {
52
                    return new JLabelBold("Description de l'appel téléphonique");
181 ilm 53
                } else if (id.equals("customerrelationship.lead.call.next")) {
140 ilm 54
                    return new JLabelBold("Suite à donner");
55
                }
56
                return super.getLabel(id);
57
            }
58
 
59
            @Override
60
            public JComponent createEditor(String id) {
61
                if (id.equals("INFORMATION")) {
181 ilm 62
                    final ITextArea jTextArea = new ITextArea();
63
                    jTextArea.setRows(20);
140 ilm 64
                    return new JScrollPane(jTextArea);
65
                } else if (id.equals("DATE")) {
66
                    return new JDate(true);
67
                }
68
                return super.createEditor(id);
69
            }
70
 
71
        };
72
    }
73
 
74
}