Line 1... |
Line 1... |
1 |
/*
|
1 |
/*
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3 |
*
|
3 |
*
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
5 |
*
|
5 |
*
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
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
|
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
|
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.
|
9 |
* language governing permissions and limitations under the License.
|
Line 16... |
Line 16... |
16 |
import org.openconcerto.erp.action.CreateIListFrameAbstractAction;
|
16 |
import org.openconcerto.erp.action.CreateIListFrameAbstractAction;
|
17 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
17 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
18 |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
|
18 |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
|
19 |
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
|
19 |
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
|
20 |
import org.openconcerto.sql.element.SQLElement;
|
20 |
import org.openconcerto.sql.element.SQLElement;
|
- |
|
21 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
- |
|
22 |
import org.openconcerto.sql.model.SQLSelect;
|
- |
|
23 |
import org.openconcerto.sql.model.Where;
|
21 |
import org.openconcerto.sql.view.IListFrame;
|
24 |
import org.openconcerto.sql.view.IListFrame;
|
- |
|
25 |
import org.openconcerto.sql.view.list.SQLTableModelSource;
|
22 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
26 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
- |
|
27 |
import org.openconcerto.utils.cc.ITransformer;
|
23 |
|
28 |
|
24 |
import java.awt.GridBagConstraints;
|
29 |
import java.awt.GridBagConstraints;
|
25 |
import java.awt.event.ActionEvent;
|
30 |
import java.awt.event.ActionEvent;
|
26 |
import java.awt.event.MouseAdapter;
|
31 |
import java.awt.event.MouseAdapter;
|
27 |
import java.awt.event.MouseEvent;
|
32 |
import java.awt.event.MouseEvent;
|
Line 30... |
Line 35... |
30 |
import javax.swing.JPopupMenu;
|
35 |
import javax.swing.JPopupMenu;
|
31 |
import javax.swing.JTable;
|
36 |
import javax.swing.JTable;
|
32 |
|
37 |
|
33 |
public class ListeDesMouvementsStockAction extends CreateIListFrameAbstractAction<MouvementStockSQLElement> {
|
38 |
public class ListeDesMouvementsStockAction extends CreateIListFrameAbstractAction<MouvementStockSQLElement> {
|
34 |
|
39 |
|
- |
|
40 |
private final SQLRowAccessor rowArtFilter;
|
- |
|
41 |
|
35 |
public ListeDesMouvementsStockAction(final ComptaPropsConfiguration conf) {
|
42 |
public ListeDesMouvementsStockAction(final ComptaPropsConfiguration conf) {
|
- |
|
43 |
this(conf, null);
|
- |
|
44 |
}
|
- |
|
45 |
|
- |
|
46 |
public ListeDesMouvementsStockAction(final ComptaPropsConfiguration conf, SQLRowAccessor rowArticleFilter) {
|
36 |
super(conf, MouvementStockSQLElement.class);
|
47 |
super(conf, MouvementStockSQLElement.class);
|
- |
|
48 |
this.rowArtFilter = rowArticleFilter;
|
- |
|
49 |
}
|
- |
|
50 |
|
- |
|
51 |
protected SQLTableModelSource createTableSource() {
|
- |
|
52 |
|
- |
|
53 |
SQLTableModelSource source = this.getElem().createTableSource();
|
- |
|
54 |
if (this.rowArtFilter != null && !this.rowArtFilter.isUndefined()) {
|
- |
|
55 |
source.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() {
|
- |
|
56 |
|
- |
|
57 |
@Override
|
- |
|
58 |
public SQLSelect transformChecked(SQLSelect input) {
|
- |
|
59 |
input.setWhere(new Where(input.getTable("MOUVEMENT_STOCK").getField("ID_ARTICLE"), "=", ListeDesMouvementsStockAction.this.rowArtFilter.getID()));
|
- |
|
60 |
return input;
|
- |
|
61 |
}
|
- |
|
62 |
});
|
- |
|
63 |
}
|
- |
|
64 |
return source;
|
37 |
}
|
65 |
}
|
38 |
|
66 |
|
39 |
@Override
|
67 |
@Override
|
40 |
protected void initFrame(IListFrame frame) {
|
68 |
protected void initFrame(IListFrame frame) {
|
41 |
super.initFrame(frame);
|
69 |
super.initFrame(frame);
|
42 |
|
70 |
|
- |
|
71 |
if (this.rowArtFilter != null && !this.rowArtFilter.isUndefined()) {
|
- |
|
72 |
frame.setTextTitle("Mouvements de stocks, article " + this.rowArtFilter.getString("CODE") + " " + this.rowArtFilter.getString("NOM"));
|
- |
|
73 |
}
|
43 |
final SQLElement element = getElem();
|
74 |
final SQLElement element = getElem();
|
44 |
|
75 |
|
45 |
JTable table = frame.getPanel().getListe().getJTable();
|
76 |
JTable table = frame.getPanel().getListe().getJTable();
|
46 |
|
77 |
|
47 |
table.addMouseListener(new MouseAdapter() {
|
78 |
table.addMouseListener(new MouseAdapter() {
|