OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 174 Rev 182
Line 1... Line 1...
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-2019 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.
Line 466... Line 466...
466
                } else if (o1 == null) {
466
                } else if (o1 == null) {
467
                    comparison = -1;
467
                    comparison = -1;
468
                } else if (o2 == null) {
468
                } else if (o2 == null) {
469
                    comparison = 1;
469
                    comparison = 1;
470
                } else {
470
                } else {
-
 
471
                    final Comparator comparator = getComparator(column);
-
 
472
                    try {
471
                    comparison = getComparator(column).compare(o1, o2);
473
                        comparison = comparator.compare(o1, o2);
-
 
474
                    } catch (Exception e) {
-
 
475
                        throw new IllegalStateException("Couldn't compare column " + column + " using " + comparator + " for objects " + o1 + " and " + o2, e);
-
 
476
                    }
472
                }
477
                }
473
                if (comparison != 0) {
478
                if (comparison != 0) {
474
                    return directive.direction == DESCENDING ? -comparison : comparison;
479
                    return directive.direction == DESCENDING ? -comparison : comparison;
475
                }
480
                }
476
            }
481
            }
Line 643... Line 648...
643
            this.tableCellRenderer = tableCellRenderer;
648
            this.tableCellRenderer = tableCellRenderer;
644
        }
649
        }
645
 
650
 
646
        @Override
651
        @Override
647
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
652
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
-
 
653
            if (column < 0) {
-
 
654
                Log.get().severe("out of bound renderer, column :" + column);
-
 
655
                return new JLabel("");
-
 
656
            }
-
 
657
 
648
            Component c = tableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
658
            Component c = tableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
649
            if (c instanceof JLabel) {
659
            if (c instanceof JLabel) {
650
                JLabel l = (JLabel) c;
660
                JLabel l = (JLabel) c;
651
                l.setHorizontalTextPosition(SwingConstants.LEFT);
661
                l.setHorizontalTextPosition(SwingConstants.LEFT);
652
                int modelColumn = table.convertColumnIndexToModel(column);
662
                int modelColumn = table.convertColumnIndexToModel(column);