OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 83 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 83 Rev 177
Line 13... Line 13...
13
 
13
 
14
 package org.openconcerto.erp.core.finance.payment.component;
14
 package org.openconcerto.erp.core.finance.payment.component;
15
 
15
 
16
import org.openconcerto.erp.config.Log;
16
import org.openconcerto.erp.config.Log;
17
import org.openconcerto.erp.core.common.element.BanqueSQLElement;
17
import org.openconcerto.erp.core.common.element.BanqueSQLElement;
-
 
18
import org.openconcerto.erp.core.finance.payment.element.ModeDeReglementSQLElement;
18
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement;
19
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement;
19
import org.openconcerto.erp.model.BanqueModifiedListener;
20
import org.openconcerto.erp.model.BanqueModifiedListener;
20
import org.openconcerto.sql.element.BaseSQLComponent;
21
import org.openconcerto.sql.element.BaseSQLComponent;
21
import org.openconcerto.sql.element.SQLElement;
22
import org.openconcerto.sql.element.SQLElement;
22
import org.openconcerto.sql.model.SQLBackgroundTableCache;
23
import org.openconcerto.sql.model.SQLBackgroundTableCache;
Line 38... Line 39...
38
import java.awt.GridBagLayout;
39
import java.awt.GridBagLayout;
39
import java.awt.event.ItemEvent;
40
import java.awt.event.ItemEvent;
40
import java.awt.event.ItemListener;
41
import java.awt.event.ItemListener;
41
import java.beans.PropertyChangeEvent;
42
import java.beans.PropertyChangeEvent;
42
import java.beans.PropertyChangeListener;
43
import java.beans.PropertyChangeListener;
-
 
44
import java.util.Date;
43
import java.util.HashMap;
45
import java.util.HashMap;
44
import java.util.Map;
46
import java.util.Map;
45
import java.util.Set;
47
import java.util.Set;
46
 
48
 
47
import javax.swing.ButtonGroup;
49
import javax.swing.ButtonGroup;
Line 277... Line 279...
277
                setEcheanceEnabled(e.getStateChange() == ItemEvent.DESELECTED);
279
                setEcheanceEnabled(e.getStateChange() == ItemEvent.DESELECTED);
278
            }
280
            }
279
        });
281
        });
280
    }
282
    }
281
 
283
 
-
 
284
    public void addDateCompListener(JDate dateParent) {
-
 
285
        dateParent.addPropertyChangeListener(new PropertyChangeListener() {
-
 
286
 
-
 
287
            @Override
-
 
288
            public void propertyChange(PropertyChangeEvent evt) {
-
 
289
                ModeDeReglementSQLComponent.this.currentDate = dateParent.getValue();
-
 
290
                refreshDatePrev();
-
 
291
            }
-
 
292
        });
-
 
293
        dateParent.addValueListener(new PropertyChangeListener() {
-
 
294
 
-
 
295
            @Override
-
 
296
            public void propertyChange(PropertyChangeEvent evt) {
-
 
297
                ModeDeReglementSQLComponent.this.currentDate = dateParent.getValue();
-
 
298
                refreshDatePrev();
-
 
299
            }
-
 
300
        });
-
 
301
    }
-
 
302
 
-
 
303
    private void refreshDatePrev() {
-
 
304
        if (this.currentDate != null) {
-
 
305
            int aJ = this.comboA.getValue().trim().length() == 0 ? 0 : Integer.valueOf(this.comboA.getValue());
-
 
306
            int nJ = this.comboLe.getValue().trim().length() == 0 ? 0 : Integer.valueOf(this.comboLe.getValue());
-
 
307
            Date d = ModeDeReglementSQLElement.calculDate(aJ, nJ, this.currentDate);
-
 
308
            this.datePrev.setDate(d);
-
 
309
        } else {
-
 
310
            this.datePrev.setDate(null);
-
 
311
        }
-
 
312
    }
-
 
313
 
-
 
314
    private JDate datePrev = new JDate();
-
 
315
    private Date currentDate = null;
-
 
316
 
282
    private void createPanelEcheance() {
317
    private void createPanelEcheance() {
283
 
318
 
284
        final GridBagConstraints c = new DefaultGridBagConstraints();
319
        final GridBagConstraints c = new DefaultGridBagConstraints();
285
        c.fill = GridBagConstraints.NONE;
320
        c.fill = GridBagConstraints.NONE;
286
        this.panelEcheance.setOpaque(false);
321
        this.panelEcheance.setOpaque(false);
Line 288... Line 323...
288
        c.gridx++;
323
        c.gridx++;
289
        c.gridwidth = 1;
324
        c.gridwidth = 1;
290
        this.comboA.setMinimumSize(new Dimension(60, this.comboA.getMinimumSize().height));
325
        this.comboA.setMinimumSize(new Dimension(60, this.comboA.getMinimumSize().height));
291
        this.comboA.setPreferredSize(new Dimension(60, this.comboA.getMinimumSize().height));
326
        this.comboA.setPreferredSize(new Dimension(60, this.comboA.getMinimumSize().height));
292
        this.comboA.setMaximumSize(new Dimension(60, this.comboA.getMinimumSize().height));
327
        this.comboA.setMaximumSize(new Dimension(60, this.comboA.getMinimumSize().height));
-
 
328
        this.comboA.addValueListener(new PropertyChangeListener() {
-
 
329
 
-
 
330
            @Override
-
 
331
            public void propertyChange(PropertyChangeEvent evt) {
-
 
332
                refreshDatePrev();
-
 
333
            }
-
 
334
        });
293
        this.panelEcheance.add(this.comboA, c);
335
        this.panelEcheance.add(this.comboA, c);
294
        c.gridx += 1;
336
        c.gridx += 1;
295
        c.gridwidth = 1;
337
        c.gridwidth = 1;
296
        this.panelEcheance.add(new JLabel("jours,"), c);
338
        this.panelEcheance.add(new JLabel("jours,"), c);
297
        c.gridx++;
339
        c.gridx++;
298
        c.weightx = 1;
340
        c.weightx = 1;
299
        c.gridwidth = 2;
341
        c.gridwidth = 2;
300
        c.fill = GridBagConstraints.HORIZONTAL;
342
        c.fill = GridBagConstraints.HORIZONTAL;
301
        this.buttonDateFacture.setOpaque(false);
343
        this.buttonDateFacture.setOpaque(false);
302
        this.panelEcheance.add(this.buttonDateFacture, c);
344
        this.panelEcheance.add(this.buttonDateFacture, c);
-
 
345
 
303
        c.gridy++;
346
        c.gridy++;
-
 
347
        c.gridx = 0;
-
 
348
        c.weightx = 1;
-
 
349
        c.gridwidth = 1;
-
 
350
        // ((BaseSQLComponent)((ElementSQLObject)getSQLParent()).getSQLParent()).getView("DATE");
-
 
351
        this.panelEcheance.add(new JLabel("Soit le"), c);
-
 
352
        c.gridx++;
-
 
353
        c.gridwidth = 1;
-
 
354
        this.datePrev.setEnabled(false);
-
 
355
        this.panelEcheance.add(this.datePrev, c);
-
 
356
 
-
 
357
        // c.gridy++;
-
 
358
        c.gridwidth = 2;
-
 
359
        c.gridx = 3;
304
        c.weightx = 0;
360
        c.weightx = 0;
305
        c.fill = GridBagConstraints.NONE;
361
        c.fill = GridBagConstraints.NONE;
306
        this.buttonFinMois.setOpaque(false);
362
        this.buttonFinMois.setOpaque(false);
307
        this.panelEcheance.add(this.buttonFinMois, c);
363
        this.panelEcheance.add(this.buttonFinMois, c);
308
        c.gridy++;
364
        c.gridy++;
Line 312... Line 368...
312
 
368
 
313
        c.gridx++;
369
        c.gridx++;
314
        this.comboLe.setMinimumSize(new Dimension(60, this.comboLe.getMinimumSize().height));
370
        this.comboLe.setMinimumSize(new Dimension(60, this.comboLe.getMinimumSize().height));
315
        this.comboLe.setPreferredSize(new Dimension(60, this.comboLe.getMinimumSize().height));
371
        this.comboLe.setPreferredSize(new Dimension(60, this.comboLe.getMinimumSize().height));
316
        this.comboLe.setMaximumSize(new Dimension(60, this.comboLe.getMinimumSize().height));
372
        this.comboLe.setMaximumSize(new Dimension(60, this.comboLe.getMinimumSize().height));
-
 
373
        this.comboLe.addValueListener(new PropertyChangeListener() {
-
 
374
 
-
 
375
            @Override
-
 
376
            public void propertyChange(PropertyChangeEvent evt) {
-
 
377
                refreshDatePrev();
-
 
378
            }
-
 
379
        });
317
        this.panelEcheance.add(this.comboLe, c);
380
        this.panelEcheance.add(this.comboLe, c);
318
        this.panelActive = this.panelEcheance;
381
        this.panelActive = this.panelEcheance;
319
        this.m.put(Mode.ECHEANCE, this.panelEcheance);
382
        this.m.put(Mode.ECHEANCE, this.panelEcheance);
320
 
383
 
321
        DefaultGridBagConstraints.lockMinimumSize(this.panelEcheance);
384
        DefaultGridBagConstraints.lockMinimumSize(this.panelEcheance);