001 // License: GPL. For details, see LICENSE file.
002 package org.openstreetmap.josm.corrector;
003
004 import static org.openstreetmap.josm.tools.I18n.tr;
005
006 import java.util.List;
007
008 public 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 public Object getCorrectionValueAt(int rowIndex, int colIndex) {
035 TagCorrection tagCorrection = getCorrections().get(rowIndex);
036
037 switch (colIndex) {
038 case 0:
039 return tagCorrection.oldKey;
040 case 1:
041 return tagCorrection.oldValue;
042 case 2:
043 return tagCorrection.newKey;
044 case 3:
045 return tagCorrection.newValue;
046 }
047 return null;
048 }
049
050 protected boolean isBoldCell(int row, int column) {
051 TagCorrection tagCorrection = getCorrections().get(row);
052 return (column == 2 && tagCorrection.isKeyChanged())
053 || (column == 3 && tagCorrection.isValueChanged());
054 }
055
056 }