Ignore:
Timestamp:
2016-01-17T02:54:22+01:00 (9 years ago)
Author:
Don-vip
Message:

massive refactoring of GenericRelationEditor. As JDialog cannot be instantiated in headless mode, extract all actions to separate classes in new package gui.dialogs.relation.actions in order to test them with JUnit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r9388 r9496  
    703703     * Sort the selected relation members by the way they are linked.
    704704     */
    705     void sort() {
     705    public void sort() {
    706706        List<RelationMember> selectedMembers = new ArrayList<>(getSelectedMembers());
    707         List<RelationMember> sortedMembers = null;
     707        List<RelationMember> sortedMembers;
    708708        List<RelationMember> newMembers;
    709709        if (selectedMembers.size() <= 1) {
     
    727727        }
    728728
    729         if (members.size() != newMembers.size()) throw new AssertionError();
     729        if (members.size() != newMembers.size())
     730            throw new AssertionError();
    730731
    731732        members.clear();
     
    738739     * Sort the selected relation members and all members below by the way they are linked.
    739740     */
    740     void sortBelow() {
    741         final List<RelationMember> subList = members.subList(getSelectionModel().getMinSelectionIndex(), members.size());
     741    public void sortBelow() {
     742        final List<RelationMember> subList = members.subList(Math.max(0, getSelectionModel().getMinSelectionIndex()), members.size());
    742743        final List<RelationMember> sorted = relationSorter.sortMembers(subList);
    743744        subList.clear();
     
    766767     * Reverse the relation members.
    767768     */
    768     void reverse() {
     769    public void reverse() {
    769770        List<Integer> selectedIndices = getSelectedIndices();
    770771        List<Integer> selectedIndicesReversed = getSelectedIndices();
Note: See TracChangeset for help on using the changeset viewer.