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.supplychain.stock.action;
|
|
|
15 |
|
156 |
ilm |
16 |
import org.openconcerto.erp.action.CreateIListFrameAbstractAction;
|
|
|
17 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
93 |
ilm |
18 |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
|
18 |
ilm |
19 |
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
|
93 |
ilm |
20 |
import org.openconcerto.sql.element.SQLElement;
|
18 |
ilm |
21 |
import org.openconcerto.sql.view.IListFrame;
|
93 |
ilm |
22 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
18 |
ilm |
23 |
|
93 |
ilm |
24 |
import java.awt.GridBagConstraints;
|
18 |
ilm |
25 |
import java.awt.event.ActionEvent;
|
|
|
26 |
import java.awt.event.MouseAdapter;
|
|
|
27 |
import java.awt.event.MouseEvent;
|
|
|
28 |
|
|
|
29 |
import javax.swing.AbstractAction;
|
|
|
30 |
import javax.swing.JPopupMenu;
|
|
|
31 |
import javax.swing.JTable;
|
|
|
32 |
|
156 |
ilm |
33 |
public class ListeDesMouvementsStockAction extends CreateIListFrameAbstractAction<MouvementStockSQLElement> {
|
18 |
ilm |
34 |
|
156 |
ilm |
35 |
public ListeDesMouvementsStockAction(final ComptaPropsConfiguration conf) {
|
|
|
36 |
super(conf, MouvementStockSQLElement.class);
|
18 |
ilm |
37 |
}
|
|
|
38 |
|
156 |
ilm |
39 |
@Override
|
|
|
40 |
protected void initFrame(IListFrame frame) {
|
|
|
41 |
super.initFrame(frame);
|
18 |
ilm |
42 |
|
156 |
ilm |
43 |
final SQLElement element = getElem();
|
18 |
ilm |
44 |
|
|
|
45 |
JTable table = frame.getPanel().getListe().getJTable();
|
|
|
46 |
|
|
|
47 |
table.addMouseListener(new MouseAdapter() {
|
|
|
48 |
public void mousePressed(MouseEvent e) {
|
|
|
49 |
if (e.getButton() == MouseEvent.BUTTON3) {
|
|
|
50 |
JPopupMenu menuDroit = new JPopupMenu();
|
|
|
51 |
menuDroit.add(new AbstractAction("Voir la source") {
|
|
|
52 |
public void actionPerformed(ActionEvent e) {
|
|
|
53 |
MouvementStockSQLElement.showSource(frame.getPanel().getListe().getSelectedId());
|
|
|
54 |
}
|
|
|
55 |
});
|
|
|
56 |
menuDroit.show(e.getComponent(), e.getPoint().x, e.getPoint().y);
|
|
|
57 |
}
|
|
|
58 |
}
|
|
|
59 |
});
|
93 |
ilm |
60 |
|
|
|
61 |
// Date panel
|
|
|
62 |
IListFilterDatePanel datePanel = new IListFilterDatePanel(frame.getPanel().getListe(), element.getTable().getField("DATE"), IListFilterDatePanel.getDefaultMap());
|
|
|
63 |
GridBagConstraints c = new DefaultGridBagConstraints();
|
|
|
64 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
|
|
65 |
c.fill = GridBagConstraints.NONE;
|
|
|
66 |
c.weightx = 0;
|
|
|
67 |
c.gridy++;
|
|
|
68 |
c.gridy++;
|
|
|
69 |
c.anchor = GridBagConstraints.CENTER;
|
|
|
70 |
datePanel.setFilterOnDefault();
|
|
|
71 |
frame.getPanel().add(datePanel, c);
|
18 |
ilm |
72 |
}
|
|
|
73 |
}
|