OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 25 | Rev 67 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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.order.action;
15
 
16
import org.openconcerto.erp.action.CreateFrameAbstractAction;
17
import org.openconcerto.erp.core.supplychain.order.element.CommandeSQLElement;
18
import org.openconcerto.erp.generationDoc.gestcomm.CommandeXmlSheet;
19
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
20
import org.openconcerto.sql.Configuration;
21
import org.openconcerto.sql.model.SQLRow;
22
import org.openconcerto.sql.view.IListFrame;
23
import org.openconcerto.sql.view.ListeAddPanel;
25 ilm 24
import org.openconcerto.sql.view.list.IListe;
25
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
26
import org.openconcerto.sql.view.list.RowAction;
27
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
18 ilm 28
 
29
import java.awt.event.ActionEvent;
30
import java.util.ArrayList;
31
import java.util.List;
32
 
33
import javax.swing.AbstractAction;
34
import javax.swing.Action;
35
import javax.swing.JFrame;
36
 
37
public class ListeDesCommandesAction extends CreateFrameAbstractAction {
38
    public ListeDesCommandesAction() {
39
        super();
40
        this.putValue(Action.NAME, "Liste des commandes fournisseurs");
41
    }
42
 
43
    public JFrame createFrame() {
44
        final IListFrame frame = new IListFrame(new ListeAddPanel(Configuration.getInstance().getDirectory().getElement("COMMANDE")));
45
 
25 ilm 46
        frame.getPanel().getListe().addIListeActions(new MouseSheetXmlListeListener(CommandeXmlSheet.class) {
18 ilm 47
            @Override
25 ilm 48
            public List<RowAction> addToMenu() {
18 ilm 49
                // Transfert vers BR
25 ilm 50
                PredicateRowAction bonAction = new PredicateRowAction(new AbstractAction("Transfert vers BR") {
18 ilm 51
                    public void actionPerformed(ActionEvent e) {
25 ilm 52
                        transfertBonReceptionClient(IListe.get(e).getSelectedRow());
18 ilm 53
                    }
25 ilm 54
                }, false);
18 ilm 55
 
25 ilm 56
                bonAction.setPredicate(IListeEvent.getSingleSelectionPredicate());
57
 
58
                List<RowAction> l = new ArrayList<RowAction>();
18 ilm 59
                l.add(bonAction);
60
                return l;
61
            }
25 ilm 62
        }.getRowActions());
18 ilm 63
 
64
        return frame;
65
    }
66
 
67
    /**
68
     * Transfert en BR
69
     *
70
     * @param row
71
     */
72
    private void transfertBonReceptionClient(SQLRow row) {
73
        CommandeSQLElement elt = (CommandeSQLElement) Configuration.getInstance().getDirectory().getElement("COMMANDE");
74
        elt.transfertBR(row.getID());
75
    }
76
 
77
}