Last change
on this file since 13265 was 12663, checked in by Don-vip, 7 years ago |
see #15182 - move NameFormatter* from gui to data.osm
|
-
Property svn:eol-style
set to
native
|
File size:
1.6 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.correction;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.util.List;
|
---|
7 |
|
---|
8 | import org.openstreetmap.josm.data.correction.RoleCorrection;
|
---|
9 | import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Role correction table model.
|
---|
13 | * @since 1001
|
---|
14 | */
|
---|
15 | public class RoleCorrectionTableModel extends CorrectionTableModel<RoleCorrection> {
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Constructs a new {@code RoleCorrectionTableModel}.
|
---|
19 | * @param roleCorrections list of role corrections
|
---|
20 | */
|
---|
21 | public RoleCorrectionTableModel(List<RoleCorrection> roleCorrections) {
|
---|
22 | super(roleCorrections);
|
---|
23 | }
|
---|
24 |
|
---|
25 | @Override
|
---|
26 | public int getColumnCount() {
|
---|
27 | return 4;
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public String getCorrectionColumnName(int colIndex) {
|
---|
32 | switch (colIndex) {
|
---|
33 | case 0:
|
---|
34 | return tr("Relation");
|
---|
35 | case 1:
|
---|
36 | return tr("Old role");
|
---|
37 | case 2:
|
---|
38 | return tr("New role");
|
---|
39 | default:
|
---|
40 | return null;
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | @Override
|
---|
45 | public Object getCorrectionValueAt(int rowIndex, int colIndex) {
|
---|
46 | RoleCorrection roleCorrection = getCorrections().get(rowIndex);
|
---|
47 |
|
---|
48 | switch (colIndex) {
|
---|
49 | case 0:
|
---|
50 | return roleCorrection.relation.getDisplayName(DefaultNameFormatter.getInstance());
|
---|
51 | case 1:
|
---|
52 | return roleCorrection.member.getRole();
|
---|
53 | case 2:
|
---|
54 | return roleCorrection.newRole;
|
---|
55 | default:
|
---|
56 | return null;
|
---|
57 | }
|
---|
58 | }
|
---|
59 |
|
---|
60 | @Override
|
---|
61 | protected boolean isBoldCell(int row, int column) {
|
---|
62 | return column == 2;
|
---|
63 | }
|
---|
64 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.