OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 132 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 132 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.customerrelationship.customer.action;
14
 package org.openconcerto.erp.core.customerrelationship.customer.action;
15
 
15
 
16
import org.openconcerto.erp.action.CreateListFrameAbstractAction;
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.customerrelationship.customer.element.ClientNormalSQLElement;
-
 
19
import org.openconcerto.erp.core.customerrelationship.customer.element.CustomerSQLElement;
18
import org.openconcerto.erp.core.sales.invoice.ui.EcheanceRenderer;
20
import org.openconcerto.erp.core.sales.invoice.ui.EcheanceRenderer;
19
import org.openconcerto.sql.Configuration;
-
 
20
import org.openconcerto.sql.model.SQLField;
21
import org.openconcerto.sql.model.SQLField;
21
import org.openconcerto.sql.model.SQLTable;
22
import org.openconcerto.sql.model.SQLTable;
22
import org.openconcerto.sql.view.IListFrame;
23
import org.openconcerto.sql.view.IListFrame;
23
import org.openconcerto.sql.view.ListeAddPanel;
-
 
24
import org.openconcerto.sql.view.list.IListe;
-
 
25
import org.openconcerto.sql.view.list.SQLTableModelSource;
-
 
26
 
24
 
27
import java.util.Set;
25
import java.util.Set;
28
 
26
 
29
import javax.swing.Action;
-
 
30
import javax.swing.JFrame;
-
 
31
import javax.swing.JTable;
27
import javax.swing.JTable;
32
 
28
 
33
public class ListeDesClientsAction extends CreateListFrameAbstractAction {
29
public class ListeDesClientsAction extends CreateIListFrameAbstractAction<ClientNormalSQLElement> {
34
 
30
 
35
    public ListeDesClientsAction() {
31
    public ListeDesClientsAction(final ComptaPropsConfiguration conf) {
36
        super();
-
 
37
        this.putValue(Action.NAME, "Liste des clients");
32
        super(conf, CustomerSQLElement.class);
38
    }
33
    }
39
 
34
 
40
    @Override
35
    @Override
41
    public String getTableName() {
-
 
42
        return "CLIENT";
-
 
43
    }
-
 
44
 
-
 
45
    protected SQLTableModelSource getTableSource() {
36
    protected void initFrame(IListFrame frame) {
46
        SQLTable tableClient = ((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("CLIENT");
-
 
47
        return Configuration.getInstance().getDirectory().getElement(tableClient).getTableSource(true);
-
 
48
    }
-
 
49
 
-
 
50
    public JFrame createFrame() {
37
        super.initFrame(frame);
51
        SQLTable tableClient = ((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("CLIENT");
-
 
52
        SQLTable tableModeReglement = Configuration.getInstance().getDirectory().getElement("MODE_REGLEMENT").getTable();
-
 
53
 
38
 
54
        final ListeAddPanel panel = new ListeAddPanel(Configuration.getInstance().getDirectory().getElement(tableClient), new IListe(getTableSource()));
39
        SQLTable tableModeReglement = getElem().getDirectory().getElement("MODE_REGLEMENT").getTable();
55
        IListFrame frame = new IListFrame(panel);
-
 
56
 
40
 
57
        // Renderer
41
        // Renderer
58
        final EcheanceRenderer rend = EcheanceRenderer.getInstance();
42
        final EcheanceRenderer rend = EcheanceRenderer.getInstance();
59
        JTable jTable = frame.getPanel().getListe().getJTable();
43
        JTable jTable = frame.getPanel().getListe().getJTable();
60
        for (int i = 0; i < jTable.getColumnCount(); i++) {
44
        for (int i = 0; i < jTable.getColumnCount(); i++) {
61
            int realColIndex = frame.getPanel().getListe().getJTable().getColumnModel().getColumn(i).getModelIndex();
45
            int realColIndex = frame.getPanel().getListe().getJTable().getColumnModel().getColumn(i).getModelIndex();
62
            final Set<SQLField> fields = frame.getPanel().getListe().getSource().getColumn(realColIndex).getFields();
46
            final Set<SQLField> fields = frame.getPanel().getListe().getSource().getColumn(realColIndex).getFields();
63
            // System.err.println("Column " + column + " Fields : " + fields);
47
            // System.err.println("Column " + column + " Fields : " + fields);
64
            if (fields.contains(tableModeReglement.getField("AJOURS"))) {
48
            if (fields.contains(tableModeReglement.getField("AJOURS"))) {
65
 
49
 
66
                // if (jTable.getColumnClass(i) == Long.class || jTable.getColumnClass(i) ==
50
                // if (jTable.getColumnClass(i) == Long.class || jTable.getColumnClass(i) ==
67
                // BigInteger.class) {
51
                // BigInteger.class) {
68
                jTable.getColumnModel().getColumn(i).setCellRenderer(rend);
52
                jTable.getColumnModel().getColumn(i).setCellRenderer(rend);
69
            }
53
            }
70
        }
54
        }
71
 
55
 
72
        panel.setSearchFullMode(true);
56
        frame.getPanel().setSearchFullMode(true);
73
        panel.setSelectRowOnAdd(false);
57
        frame.getPanel().setSelectRowOnAdd(false);
74
        return frame;
-
 
75
    }
58
    }
76
}
59
}