147 |
ilm |
1 |
package org.openconcerto.modules.customersupport;
|
|
|
2 |
|
|
|
3 |
import java.awt.Dimension;
|
|
|
4 |
import java.util.ArrayList;
|
|
|
5 |
import java.util.HashSet;
|
|
|
6 |
import java.util.List;
|
|
|
7 |
import java.util.Set;
|
|
|
8 |
|
|
|
9 |
import javax.swing.JComponent;
|
|
|
10 |
import javax.swing.JLabel;
|
|
|
11 |
import javax.swing.JScrollPane;
|
|
|
12 |
import javax.swing.JTextArea;
|
|
|
13 |
|
|
|
14 |
import org.openconcerto.erp.core.edm.AttachmentAction;
|
|
|
15 |
import org.openconcerto.erp.modules.AbstractModule;
|
|
|
16 |
import org.openconcerto.erp.modules.ModuleElement;
|
|
|
17 |
import org.openconcerto.sql.element.GroupSQLComponent;
|
|
|
18 |
import org.openconcerto.sql.element.SQLComponent;
|
|
|
19 |
import org.openconcerto.sql.model.SQLRowValues;
|
|
|
20 |
import org.openconcerto.sql.users.UserManager;
|
|
|
21 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
|
|
|
22 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
|
|
|
23 |
import org.openconcerto.ui.JDateTime;
|
|
|
24 |
|
|
|
25 |
public class CustomerTicketHistorySQLElement extends ModuleElement {
|
|
|
26 |
|
|
|
27 |
public CustomerTicketHistorySQLElement(AbstractModule module) {
|
|
|
28 |
super(module, Module.TABLE_CUSTOMER_SUPPORT_TICKET_HISTORY);
|
|
|
29 |
this.setL18nLocation(CustomerTicketHistorySQLElement.class);
|
|
|
30 |
PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction().getAction(), true);
|
|
|
31 |
actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
|
|
32 |
getRowActions().add(actionAttachment);
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
@Override
|
|
|
36 |
protected String createCode() {
|
|
|
37 |
return "customersupport.ticket.history";
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
@Override
|
|
|
41 |
protected List<String> getListFields() {
|
|
|
42 |
final List<String> l = new ArrayList<String>();
|
|
|
43 |
l.add("ID_USER_COMMON");
|
|
|
44 |
l.add("DATE");
|
|
|
45 |
l.add("ID_" + Module.TABLE_CUSTOMER_SUPPORT_TICKET);
|
|
|
46 |
l.add("INFORMATION");
|
|
|
47 |
return l;
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
@Override
|
|
|
51 |
protected List<String> getComboFields() {
|
|
|
52 |
final List<String> l = new ArrayList<String>();
|
|
|
53 |
l.add("DATE");
|
|
|
54 |
l.add("INFORMATION");
|
|
|
55 |
return l;
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
@Override
|
|
|
59 |
protected String getParentFFName() {
|
|
|
60 |
return "ID_" + Module.TABLE_CUSTOMER_SUPPORT_TICKET;
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
@Override
|
|
|
64 |
public SQLComponent createComponent() {
|
|
|
65 |
return new GroupSQLComponent(this, new CustomerTicketSupportHistoryGroup()) {
|
|
|
66 |
|
|
|
67 |
@Override
|
|
|
68 |
protected Set<String> createRequiredNames() {
|
|
|
69 |
final Set<String> s = new HashSet<String>(1);
|
|
|
70 |
s.add("ID_USER_COMMON");
|
|
|
71 |
s.add("DATE");
|
|
|
72 |
return s;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
// @Override
|
|
|
76 |
// public JComponent getLabel(String id) {
|
|
|
77 |
// if (id.equals("customerrelationship.lead.call.content")) {
|
|
|
78 |
// return new JLabelBold("Description de l'appel téléphonique");
|
|
|
79 |
// } else if (id.equals("customerrelationship.lead.call.next")) {
|
|
|
80 |
// return new JLabelBold("Suite à donner");
|
|
|
81 |
// }
|
|
|
82 |
// return super.getLabel(id);
|
|
|
83 |
// }
|
|
|
84 |
|
|
|
85 |
@Override
|
|
|
86 |
public JComponent createEditor(String id) {
|
|
|
87 |
if (id.equals("INFORMATION")) {
|
|
|
88 |
final JTextArea jTextArea = new JTextArea();
|
|
|
89 |
jTextArea.setFont(new JLabel().getFont());
|
|
|
90 |
jTextArea.setMinimumSize(new Dimension(200, 150));
|
|
|
91 |
jTextArea.setPreferredSize(new Dimension(200, 150));
|
|
|
92 |
return new JScrollPane(jTextArea);
|
|
|
93 |
} else if (id.equals("DATE")) {
|
|
|
94 |
return new JDateTime(true);
|
|
|
95 |
}
|
|
|
96 |
return super.createEditor(id);
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
@Override
|
|
|
100 |
protected SQLRowValues createDefaults() {
|
|
|
101 |
SQLRowValues rowVals = new SQLRowValues(getTable());
|
|
|
102 |
final int idUser = UserManager.getInstance().getCurrentUser().getId();
|
|
|
103 |
rowVals.put("ID_USER_COMMON", idUser);
|
|
|
104 |
return rowVals;
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
};
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
}
|