source: josm/trunk/src/org/openstreetmap/josm/corrector/RoleCorrectionTableModel.java@ 1862

Last change on this file since 1862 was 1814, checked in by Gubaer, 15 years ago

removed dependencies to Main.ds, removed Main.ds
removed AddVisitor, NameVisitor, DeleteVisitor - unnecessary double dispatching for these simple cases

File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.corrector;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.util.List;
7
8import org.openstreetmap.josm.gui.PrimitiveNameFormatter;
9
10public class RoleCorrectionTableModel extends
11CorrectionTableModel<RoleCorrection> {
12 private static final PrimitiveNameFormatter NAME_FORMATTER = new PrimitiveNameFormatter();
13
14 public RoleCorrectionTableModel(List<RoleCorrection> roleCorrections) {
15 super(roleCorrections);
16 }
17
18 @Override
19 public int getColumnCount() {
20 return 4;
21 }
22
23 @Override
24 public String getCorrectionColumnName(int colIndex) {
25 switch (colIndex) {
26 case 0:
27 return tr("Relation");
28 case 1:
29 return tr("Old role");
30 case 2:
31 return tr("New role");
32 }
33 return null;
34 }
35
36 @Override
37 public Object getCorrectionValueAt(int rowIndex, int colIndex) {
38 RoleCorrection roleCorrection = getCorrections().get(rowIndex);
39
40 switch (colIndex) {
41 case 0:
42 return NAME_FORMATTER.getName(roleCorrection.relation);
43 case 1:
44 return roleCorrection.member.role;
45 case 2:
46 return roleCorrection.newRole;
47 }
48 return null;
49 }
50
51 @Override
52 protected boolean isBoldCell(int row, int column) {
53 return column == 2;
54 }
55
56}
Note: See TracBrowser for help on using the repository browser.