source: josm/trunk/src/org/openstreetmap/josm/gui/correction/TagCorrectionTableModel.java@ 10755

Last change on this file since 10755 was 10125, checked in by Don-vip, 8 years ago

refactor classes from corrector package, add javadoc

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.correction;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.util.List;
7
8import org.openstreetmap.josm.data.correction.TagCorrection;
9
10/**
11 * Tag correction table model.
12 * @since 729
13 */
14public class TagCorrectionTableModel extends CorrectionTableModel<TagCorrection> {
15
16 /**
17 * Constructs a new {@code TagCorrectionTableModel}.
18 * @param tagCorrections list of tag corrections
19 */
20 public TagCorrectionTableModel(List<TagCorrection> tagCorrections) {
21 super(tagCorrections);
22 }
23
24 @Override
25 public int getColumnCount() {
26 return 5;
27 }
28
29 @Override
30 public String getCorrectionColumnName(int colIndex) {
31 switch (colIndex) {
32 case 0:
33 return tr("Old key");
34 case 1:
35 return tr("Old value");
36 case 2:
37 return tr("New key");
38 case 3:
39 return tr("New value");
40 default:
41 return null;
42 }
43 }
44
45 @Override
46 public Object getCorrectionValueAt(int rowIndex, int colIndex) {
47 TagCorrection tagCorrection = getCorrections().get(rowIndex);
48
49 switch (colIndex) {
50 case 0:
51 return tagCorrection.oldKey;
52 case 1:
53 return tagCorrection.oldValue;
54 case 2:
55 return tagCorrection.newKey;
56 case 3:
57 return tagCorrection.newValue;
58 default:
59 return null;
60 }
61 }
62
63 @Override
64 protected boolean isBoldCell(int row, int column) {
65 TagCorrection tagCorrection = getCorrections().get(row);
66 return (column == 2 && tagCorrection.isKeyChanged())
67 || (column == 3 && tagCorrection.isValueChanged());
68 }
69}
Note: See TracBrowser for help on using the repository browser.