OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 151 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 151 Rev 156
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 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.
10
 * 
10
 * 
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.core.sales.credit.action;
14
 package org.openconcerto.erp.core.sales.credit.action;
15
 
15
 
16
import org.openconcerto.erp.action.CreateFrameAbstractAction;
16
import org.openconcerto.erp.action.CreateIListFrameAbstractAction;
-
 
17
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
18
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
18
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
19
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
19
import org.openconcerto.erp.core.finance.accounting.ui.ListeGestCommEltPanel;
20
import org.openconcerto.erp.core.finance.accounting.ui.ListeGestCommEltPanel;
20
import org.openconcerto.erp.generationDoc.gestcomm.AvoirClientXmlSheet;
21
import org.openconcerto.erp.core.sales.credit.element.AvoirClientSQLElement;
21
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
-
 
22
import org.openconcerto.sql.Configuration;
-
 
23
import org.openconcerto.sql.element.SQLElement;
22
import org.openconcerto.sql.element.SQLElement;
24
import org.openconcerto.sql.model.SQLField;
23
import org.openconcerto.sql.model.SQLField;
25
import org.openconcerto.sql.view.IListFrame;
24
import org.openconcerto.sql.view.IListPanel;
-
 
25
import org.openconcerto.sql.view.list.IListe;
-
 
26
import org.openconcerto.sql.view.list.SQLTableModelSource;
26
import org.openconcerto.ui.DefaultGridBagConstraints;
27
import org.openconcerto.ui.DefaultGridBagConstraints;
27
 
28
 
28
import java.awt.GridBagConstraints;
29
import java.awt.GridBagConstraints;
29
import java.util.ArrayList;
30
import java.util.ArrayList;
30
import java.util.List;
31
import java.util.List;
31
 
32
 
32
import javax.swing.Action;
33
public class ListeDesAvoirsClientsAction extends CreateIListFrameAbstractAction<AvoirClientSQLElement> {
33
import javax.swing.JFrame;
-
 
34
 
34
 
35
public class ListeDesAvoirsClientsAction extends CreateFrameAbstractAction {
35
    public ListeDesAvoirsClientsAction(final ComptaPropsConfiguration conf) {
36
 
-
 
37
    public ListeDesAvoirsClientsAction() {
36
        super(conf, AvoirClientSQLElement.class);
38
        super();
-
 
39
        this.putValue(Action.NAME, "Liste des avoirs client");
-
 
40
    }
37
    }
41
 
38
 
42
    public JFrame createFrame() {
39
    @Override
-
 
40
    protected IListPanel instantiateListPanel(SQLTableModelSource tableSource, String panelVariant) {
43
        final SQLElement element = Configuration.getInstance().getDirectory().getElement("AVOIR_CLIENT");
41
        final SQLElement element = tableSource.getElem();
44
        ListeGestCommEltPanel panel = new ListeGestCommEltPanel(element);
42
        final ListeGestCommEltPanel panel = new ListeGestCommEltPanel(element, new IListe(tableSource), panelVariant);
45
        panel.setAddVisible(true);
43
        panel.setAddVisible(true);
46
        final IListFrame frame = new IListFrame(panel);
-
 
47
 
44
 
48
        List<SQLField> fields = new ArrayList<SQLField>(2);
45
        List<SQLField> fields = new ArrayList<SQLField>(2);
49
        fields.add(element.getTable().getField("MONTANT_HT"));
46
        fields.add(element.getTable().getField("MONTANT_HT"));
50
        fields.add(element.getTable().getField("MONTANT_TTC"));
47
        fields.add(element.getTable().getField("MONTANT_TTC"));
51
        IListTotalPanel totalPanel = new IListTotalPanel(frame.getPanel().getListe(), fields, "Total Global");
48
        IListTotalPanel totalPanel = new IListTotalPanel(panel.getListe(), fields, "Total Global");
52
        GridBagConstraints c = new DefaultGridBagConstraints();
49
        GridBagConstraints c = new DefaultGridBagConstraints();
53
        c.gridwidth = GridBagConstraints.REMAINDER;
50
        c.gridwidth = GridBagConstraints.REMAINDER;
54
        c.fill = GridBagConstraints.NONE;
51
        c.fill = GridBagConstraints.NONE;
55
        c.weightx = 0;
52
        c.weightx = 0;
56
 
53
 
57
        // Total panel
54
        // Total panel
58
        c.gridwidth = GridBagConstraints.REMAINDER;
55
        c.gridwidth = GridBagConstraints.REMAINDER;
59
        c.fill = GridBagConstraints.NONE;
56
        c.fill = GridBagConstraints.NONE;
60
        c.anchor = GridBagConstraints.EAST;
57
        c.anchor = GridBagConstraints.EAST;
61
        c.weightx = 1;
58
        c.weightx = 1;
62
        c.gridy = 4;
59
        c.gridy = 4;
63
        frame.getPanel().add(totalPanel, c);
60
        panel.add(totalPanel, c);
64
 
61
 
65
        // Date panel
62
        // Date panel
66
        IListFilterDatePanel datePanel = new IListFilterDatePanel(frame.getPanel().getListe(), element.getTable().getField("DATE"), IListFilterDatePanel.getDefaultMap());
63
        IListFilterDatePanel datePanel = new IListFilterDatePanel(panel.getListe(), element.getTable().getField("DATE"), IListFilterDatePanel.getDefaultMap());
67
        c.gridy++;
64
        c.gridy++;
68
        c.anchor = GridBagConstraints.CENTER;
65
        c.anchor = GridBagConstraints.CENTER;
69
        datePanel.setFilterOnDefault();
66
        datePanel.setFilterOnDefault();
70
        frame.getPanel().add(datePanel, c);
67
        panel.add(datePanel, c);
71
 
68
 
72
        frame.getPanel().getListe().setModificationAllowed(false);
69
        panel.getListe().setModificationAllowed(false);
73
        return frame;
70
        return panel;
74
    }
71
    }
75
}
72
}