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 import org.openstreetmap.josm.gui.DefaultNameFormatter; 009 010 public class RoleCorrectionTableModel extends 011 CorrectionTableModel<RoleCorrection> { 012 013 public RoleCorrectionTableModel(List<RoleCorrection> roleCorrections) { 014 super(roleCorrections); 015 } 016 017 @Override 018 public int getColumnCount() { 019 return 4; 020 } 021 022 @Override 023 public String getCorrectionColumnName(int colIndex) { 024 switch (colIndex) { 025 case 0: 026 return tr("Relation"); 027 case 1: 028 return tr("Old role"); 029 case 2: 030 return tr("New role"); 031 } 032 return null; 033 } 034 035 @Override 036 public Object getCorrectionValueAt(int rowIndex, int colIndex) { 037 RoleCorrection roleCorrection = getCorrections().get(rowIndex); 038 039 switch (colIndex) { 040 case 0: 041 return roleCorrection.relation.getDisplayName(DefaultNameFormatter.getInstance()); 042 case 1: 043 return roleCorrection.member.getRole(); 044 case 2: 045 return roleCorrection.newRole; 046 } 047 return null; 048 } 049 050 @Override 051 protected boolean isBoldCell(int row, int column) { 052 return column == 2; 053 } 054 055 }