Ignore:
Timestamp:
2019-01-12T14:30:57+01:00 (6 weeks ago)
Author:
simon04
Message:

HistoryViewer: fix code duplication

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListViewer.java

    r14463 r14675  
    3737    @Override
    3838    protected JTable buildReferenceTable() {
    39         JTable table = new JTable(
    40                 model.getRelationMemberTableModel(PointInTimeType.REFERENCE_POINT_IN_TIME),
    41                 new RelationMemberTableColumnModel()
    42                 );
    43         table.setName("table.referencememberlisttable");
    44         table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    45         selectionSynchronizer.participateInSynchronizedSelection(table.getSelectionModel());
    46         table.getModel().addTableModelListener(new MemberModelChanged(table));
    47         return table;
     39        return buildTable(PointInTimeType.REFERENCE_POINT_IN_TIME, "table.referencememberlisttable");
    4840    }
    4941
    5042    @Override
    5143    protected JTable buildCurrentTable() {
     44        return buildTable(PointInTimeType.CURRENT_POINT_IN_TIME, "table.currentmemberlisttable");
     45    }
     46
     47    private JTable buildTable(PointInTimeType pointInTimeType, String name) {
    5248        JTable table = new JTable(
    53                 model.getRelationMemberTableModel(PointInTimeType.CURRENT_POINT_IN_TIME),
    54                 new RelationMemberTableColumnModel()
    55                 );
    56         table.setName("table.currentmemberlisttable");
     49                model.getRelationMemberTableModel(pointInTimeType),
     50                new RelationMemberTableColumnModel());
     51        table.setName(name);
    5752        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    5853        selectionSynchronizer.participateInSynchronizedSelection(table.getSelectionModel());
Note: See TracChangeset for help on using the changeset viewer.