OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 142 Rev 174
Line 43... Line 43...
43
 
43
 
44
    // Black
44
    // Black
45
    public final static Color lightBlack = new Color(192, 192, 192);
45
    public final static Color lightBlack = new Color(192, 192, 192);
46
    public final static Color lightBlackGrey = new Color(155, 155, 155);
46
    public final static Color lightBlackGrey = new Color(155, 155, 155);
47
 
47
 
-
 
48
    private final boolean customer;
-
 
49
 
48
    public DeliveredQtyRowValuesRenderer() {
50
    public DeliveredQtyRowValuesRenderer() {
-
 
51
        this(true);
-
 
52
    }
-
 
53
 
-
 
54
    public DeliveredQtyRowValuesRenderer(boolean customer) {
49
        AlternateTableCellRenderer.setBGColorMap(this, CollectionUtils.createMap(lightBlack, lightBlackGrey, red, redLightGrey, orange, orangeGrey));
55
        AlternateTableCellRenderer.setBGColorMap(this, CollectionUtils.createMap(lightBlack, lightBlackGrey, red, redLightGrey, orange, orangeGrey));
-
 
56
        this.customer = customer;
50
    }
57
    }
51
 
58
 
52
    @Override
59
    @Override
53
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
60
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
54
 
61
 
Line 58... Line 65...
58
 
65
 
59
            ((JLabel) comp).setHorizontalAlignment(SwingConstants.RIGHT);
66
            ((JLabel) comp).setHorizontalAlignment(SwingConstants.RIGHT);
60
            RowValuesTableModel model = ((RowValuesTable) table).getRowValuesTableModel();
67
            RowValuesTableModel model = ((RowValuesTable) table).getRowValuesTableModel();
61
            SQLRowValues rowVals = model.getRowValuesAt(row);
68
            SQLRowValues rowVals = model.getRowValuesAt(row);
62
 
69
 
-
 
70
            Number qte;
-
 
71
            Number qteL;
-
 
72
            if (this.customer) {
63
            Number qte = (Number) rowVals.getObject("QTE");
73
                qte = (Number) rowVals.getObject("QTE");
64
            Number qteL = (Number) rowVals.getObject("QTE_LIVREE");
74
                qteL = (Number) rowVals.getObject("QTE_LIVREE");
-
 
75
            } else {
-
 
76
                qte = (Number) rowVals.getObject("QTE_ORIGINE");
-
 
77
                qteL = (Number) rowVals.getObject("QTE");
-
 
78
            }
65
            if (qte != null && qteL != null) {
79
            if (qte != null && qteL != null) {
66
                if (qte.intValue() < qteL.intValue()) {
80
                if (qte.intValue() < qteL.intValue()) {
67
                    comp.setBackground(red);
81
                    comp.setBackground(red);
68
                } else if (qteL.intValue() <= 0) {
82
                } else if (qteL.intValue() <= 0) {
69
                    comp.setBackground(lightBlack);
83
                    comp.setBackground(lightBlack);