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.finance.payment.action;
|
|
|
15 |
|
|
|
16 |
import org.openconcerto.erp.action.CreateFrameAbstractAction;
|
132 |
ilm |
17 |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
|
18 |
ilm |
18 |
import org.openconcerto.sql.Configuration;
|
|
|
19 |
import org.openconcerto.sql.element.SQLElement;
|
93 |
ilm |
20 |
import org.openconcerto.sql.model.SQLRowValues;
|
18 |
ilm |
21 |
import org.openconcerto.sql.view.IListFrame;
|
|
|
22 |
import org.openconcerto.sql.view.ListeAddPanel;
|
|
|
23 |
import org.openconcerto.sql.view.list.SQLTableModelColumn;
|
|
|
24 |
import org.openconcerto.sql.view.list.SQLTableModelColumnPath;
|
|
|
25 |
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
|
132 |
ilm |
26 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
|
|
27 |
import org.openconcerto.utils.cc.ITransformer;
|
18 |
ilm |
28 |
|
132 |
ilm |
29 |
import java.awt.GridBagConstraints;
|
18 |
ilm |
30 |
|
|
|
31 |
import javax.swing.Action;
|
132 |
ilm |
32 |
import javax.swing.JButton;
|
18 |
ilm |
33 |
import javax.swing.JFrame;
|
|
|
34 |
|
180 |
ilm |
35 |
public class ListeDesRelancesAction extends CreateFrameAbstractAction {
|
18 |
ilm |
36 |
|
|
|
37 |
private IListFrame frame;
|
|
|
38 |
|
|
|
39 |
public ListeDesRelancesAction() {
|
|
|
40 |
super();
|
|
|
41 |
this.putValue(Action.NAME, "Liste des relances");
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
public JFrame createFrame() {
|
|
|
45 |
final SQLElement elt = Configuration.getInstance().getDirectory().getElement("RELANCE");
|
132 |
ilm |
46 |
this.frame = new IListFrame(new ListeAddPanel(elt) {
|
|
|
47 |
@Override
|
|
|
48 |
protected void createUI() {
|
|
|
49 |
super.createUI();
|
18 |
ilm |
50 |
|
132 |
ilm |
51 |
this.btnMngr.setAdditional(this.buttonModifier, new ITransformer<JButton, String>() {
|
|
|
52 |
|
|
|
53 |
@Override
|
|
|
54 |
public String transformChecked(JButton input) {
|
|
|
55 |
|
180 |
ilm |
56 |
SQLRowValues row = getListe().getSelectedRow();
|
132 |
ilm |
57 |
|
180 |
ilm |
58 |
if (row.getObject("ID_TYPE_LETTRE_RELANCE") == null || row.isForeignEmpty("ID_TYPE_LETTRE_RELANCE")) {
|
132 |
ilm |
59 |
return "Vous ne pouvez pas modifier une relance envoyée par mail!";
|
|
|
60 |
}
|
|
|
61 |
return null;
|
|
|
62 |
}
|
|
|
63 |
});
|
|
|
64 |
}
|
|
|
65 |
});
|
|
|
66 |
|
18 |
ilm |
67 |
final SQLTableModelSourceOnline src = (SQLTableModelSourceOnline) this.frame.getPanel().getListe().getModel().getReq();
|
|
|
68 |
|
151 |
ilm |
69 |
this.frame.getPanel().getListe().setModificationAllowed(true);
|
18 |
ilm |
70 |
|
|
|
71 |
for (SQLTableModelColumn column : src.getColumns()) {
|
|
|
72 |
if (column.getClass().isAssignableFrom(SQLTableModelColumnPath.class)) {
|
|
|
73 |
((SQLTableModelColumnPath) column).setEditable(false);
|
|
|
74 |
}
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
((SQLTableModelColumnPath) src.getColumns(elt.getTable().getField("INFOS")).iterator().next()).setEditable(true);
|
|
|
78 |
|
|
|
79 |
this.frame.getPanel().setAddVisible(false);
|
132 |
ilm |
80 |
|
|
|
81 |
// Date panel
|
|
|
82 |
GridBagConstraints c = new DefaultGridBagConstraints();
|
|
|
83 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
|
|
84 |
c.fill = GridBagConstraints.NONE;
|
|
|
85 |
c.weightx = 0;
|
|
|
86 |
c.gridy = 4;
|
|
|
87 |
|
|
|
88 |
IListFilterDatePanel datePanel = new IListFilterDatePanel(frame.getPanel().getListe(), elt.getTable().getField("DATE"), IListFilterDatePanel.getDefaultMap());
|
|
|
89 |
c.gridy++;
|
|
|
90 |
c.anchor = GridBagConstraints.CENTER;
|
|
|
91 |
datePanel.setFilterOnDefault();
|
|
|
92 |
frame.getPanel().add(datePanel, c);
|
|
|
93 |
|
18 |
ilm |
94 |
return this.frame;
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
}
|