001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.corrector;
003
004import static org.openstreetmap.josm.tools.I18n.tr;
005
006import java.util.List;
007
008public class TagCorrectionTableModel extends CorrectionTableModel<TagCorrection> {
009
010    public TagCorrectionTableModel(List<TagCorrection> tagCorrections) {
011        super(tagCorrections);
012    }
013
014    @Override
015    public int getColumnCount() {
016        return 5;
017    }
018
019    @Override
020    public String getCorrectionColumnName(int colIndex) {
021        switch (colIndex) {
022        case 0:
023            return tr("Old key");
024        case 1:
025            return tr("Old value");
026        case 2:
027            return tr("New key");
028        case 3:
029            return tr("New value");
030        }
031        return null;
032    }
033
034    @Override
035    public Object getCorrectionValueAt(int rowIndex, int colIndex) {
036        TagCorrection tagCorrection = getCorrections().get(rowIndex);
037
038        switch (colIndex) {
039        case 0:
040            return tagCorrection.oldKey;
041        case 1:
042            return tagCorrection.oldValue;
043        case 2:
044            return tagCorrection.newKey;
045        case 3:
046            return tagCorrection.newValue;
047        }
048        return null;
049    }
050
051    @Override
052    protected boolean isBoldCell(int row, int column) {
053        TagCorrection tagCorrection = getCorrections().get(row);
054        return (column == 2 && tagCorrection.isKeyChanged())
055                || (column == 3 && tagCorrection.isValueChanged());
056    }
057
058}