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