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