Changeset 10047 in josm


Ignore:
Timestamp:
2016-03-26T16:00:08+01:00 (4 years ago)
Author:
Don-vip
Message:

add more unit tests

Location:
trunk
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java

    r10031 r10047  
    9494        @Override
    9595        public void paint(Graphics2D g, MapView mv, Bounds bbox) {
    96             ImproveWayAccuracyAction.this.paint(g, mv, bbox);;
     96            ImproveWayAccuracyAction.this.paint(g, mv, bbox);
    9797        }
    9898    };
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListEditor.java

    r9759 r10047  
    2828public class ListEditor extends AbstractListEditor<String> {
    2929
    30     private final List<String> data;
     30    private final ListSettingTableModel model;
    3131
    3232    /**
     
    3838    public ListEditor(final JComponent gui, PrefEntry entry, ListSetting setting) {
    3939        super(gui, tr("Change list setting"), entry);
    40         List<String> orig = setting.getValue();
    41         if (orig != null) {
    42             data = new ArrayList<>(orig);
    43         } else {
    44             data = new ArrayList<>();
    45         }
     40        model = new ListSettingTableModel(setting.getValue());
    4641        setContent(build(), false);
    4742    }
     
    4944    @Override
    5045    public List<String> getData() {
    51         return new ArrayList<>(Utils.filter(data, new Predicate<String>() {
     46        return new ArrayList<>(Utils.filter(model.getData(), new Predicate<String>() {
    5247            @Override
    5348            public boolean evaluate(String object) {
     
    6156        JPanel p = new JPanel(new GridBagLayout());
    6257        p.add(new JLabel(tr("Key: {0}", entry.getKey())), GBC.eol().insets(0, 0, 5, 0));
    63         ListSettingTableModel listModel = new ListSettingTableModel();
    64         JTable table = new JTable(listModel);
     58        JTable table = new JTable(model);
    6559        table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    6660        table.setTableHeader(null);
     
    7569    }
    7670
    77     class ListSettingTableModel extends AbstractTableModel {
     71    static class ListSettingTableModel extends AbstractTableModel {
     72
     73        private final List<String> data;
     74
     75        ListSettingTableModel(List<String> orig) {
     76            if (orig != null) {
     77                data = new ArrayList<>(orig);
     78            } else {
     79                data = new ArrayList<>();
     80            }
     81        }
    7882
    7983        public List<String> getData() {
Note: See TracChangeset for help on using the changeset viewer.