OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev Author Line No. Line
93 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
182 ilm 4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
93 ilm 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.sales.quote.action;
15
 
16
import org.openconcerto.erp.action.CreateFrameAbstractAction;
132 ilm 17
import org.openconcerto.erp.config.ComptaPropsConfiguration;
93 ilm 18
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
19
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
20
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
21
import org.openconcerto.sql.Configuration;
22
import org.openconcerto.sql.element.SQLElement;
23
import org.openconcerto.sql.model.SQLField;
24
import org.openconcerto.sql.model.Where;
25
import org.openconcerto.sql.view.IListFrame;
26
import org.openconcerto.sql.view.list.IListe;
27
import org.openconcerto.ui.DefaultGridBagConstraints;
28
 
29
import java.awt.GridBagConstraints;
30
import java.util.ArrayList;
31
import java.util.List;
32
 
33
import javax.swing.Action;
34
import javax.swing.JFrame;
35
 
36
public class ListeDesElementsDevisAction extends CreateFrameAbstractAction {
37
 
182 ilm 38
    private final String title;
39
 
40
    public ListeDesElementsDevisAction(ComptaPropsConfiguration conf) {
93 ilm 41
        super();
182 ilm 42
            this.title = "Liste des articles proposés";
43
        this.putValue(Action.NAME, this.title);
93 ilm 44
    }
45
 
46
    public JFrame createFrame() {
47
        final SQLElement element = Configuration.getInstance().getDirectory().getElement("DEVIS_ELEMENT");
48
 
49
        IListe liste = new IListe(element.getTableSource(true));
50
        final ListeViewPanel listeAddPanel = new ListeViewPanel(element, liste);
132 ilm 51
 
93 ilm 52
        GridBagConstraints c = new DefaultGridBagConstraints();
53
        c.gridy = 2;
54
        c.weightx = 0;
55
        c.weighty = 0;
56
        c.anchor = GridBagConstraints.EAST;
57
        c.fill = GridBagConstraints.NONE;
132 ilm 58
 
182 ilm 59
        listeAddPanel.getListe().getRequest().setWhere(new Where(element.getTable().getField("ID_DEVIS"), ">", 1));
60
        List<SQLField> l = new ArrayList<SQLField>();
61
        l.add(element.getTable().getField("T_PV_HT"));
62
        l.add(element.getTable().getField("T_PV_TTC"));
63
        IListTotalPanel total = new IListTotalPanel(listeAddPanel.getListe(), l);
64
        listeAddPanel.add(total, c);
65
 
93 ilm 66
        IListFrame frame = new IListFrame(listeAddPanel);
182 ilm 67
        frame.setTextTitle(this.title);
151 ilm 68
        frame.getPanel().getListe().setModificationAllowed(false);
93 ilm 69
        frame.getPanel().setAddVisible(false);
132 ilm 70
        frame.getPanel().setShowReadOnlyFrameOnDoubleClick(false);
71
        frame.getPanel().setModifyVisible(false);
93 ilm 72
        frame.getPanel().setSearchFullMode(true);
73
 
74
        // Date panel
75
        IListFilterDatePanel datePanel = new IListFilterDatePanel(frame.getPanel().getListe(), element.getTable().getTable("DEVIS").getField("DATE"), IListFilterDatePanel.getDefaultMap());
76
        c.gridy++;
77
        c.anchor = GridBagConstraints.CENTER;
78
        frame.getPanel().add(datePanel, c);
79
 
80
        return frame;
81
    }
82
}