OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | 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.customerrelationship.customer.action;
15
 
156 ilm 16
import org.openconcerto.erp.action.CreateIListFrameAbstractAction;
18 ilm 17
import org.openconcerto.erp.config.ComptaPropsConfiguration;
18
import org.openconcerto.erp.core.sales.invoice.ui.EcheanceRenderer;
174 ilm 19
import org.openconcerto.sql.element.SQLElement;
18 ilm 20
import org.openconcerto.sql.model.SQLField;
21
import org.openconcerto.sql.model.SQLTable;
22
import org.openconcerto.sql.view.IListFrame;
23
 
24
import java.util.Set;
25
 
26
import javax.swing.JTable;
27
 
174 ilm 28
public class ListeDesClientsAction extends CreateIListFrameAbstractAction<SQLElement> {
18 ilm 29
 
156 ilm 30
    public ListeDesClientsAction(final ComptaPropsConfiguration conf) {
174 ilm 31
        // handle CustomerSQLElement/ClientSocieteSQLElement (or even a module replacing the
32
        // default element)
33
        super(conf, conf.getDirectory().getElement(conf.getRootSociete().getTable("CLIENT")));
18 ilm 34
    }
35
 
83 ilm 36
    @Override
156 ilm 37
    protected void initFrame(IListFrame frame) {
38
        super.initFrame(frame);
83 ilm 39
 
156 ilm 40
        SQLTable tableModeReglement = getElem().getDirectory().getElement("MODE_REGLEMENT").getTable();
41 ilm 41
 
18 ilm 42
        // Renderer
43
        final EcheanceRenderer rend = EcheanceRenderer.getInstance();
44
        JTable jTable = frame.getPanel().getListe().getJTable();
45
        for (int i = 0; i < jTable.getColumnCount(); i++) {
46
            int realColIndex = frame.getPanel().getListe().getJTable().getColumnModel().getColumn(i).getModelIndex();
47
            final Set<SQLField> fields = frame.getPanel().getListe().getSource().getColumn(realColIndex).getFields();
48
            // System.err.println("Column " + column + " Fields : " + fields);
49
            if (fields.contains(tableModeReglement.getField("AJOURS"))) {
50
 
51
                // if (jTable.getColumnClass(i) == Long.class || jTable.getColumnClass(i) ==
52
                // BigInteger.class) {
53
                jTable.getColumnModel().getColumn(i).setCellRenderer(rend);
54
            }
55
        }
56
 
156 ilm 57
        frame.getPanel().setSearchFullMode(true);
58
        frame.getPanel().setSelectRowOnAdd(false);
18 ilm 59
    }
60
}