Changeset 9368 in josm for trunk/src/org


Ignore:
Timestamp:
2016-01-09T22:20:46+01:00 (4 years ago)
Author:
simon04
Message:

see #12300 - Drag and Drop support for relation member list reordering

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
3 added
2 edited

Legend:

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

    r9078 r9368  
    1515
    1616import javax.swing.AbstractAction;
     17import javax.swing.DropMode;
    1718import javax.swing.JComponent;
    1819import javax.swing.JPopupMenu;
     
    8384        getActionMap().put("selectNextColumnCell", new SelectNextColumnCellAction());
    8485        getActionMap().put("selectPreviousColumnCell", new SelectPreviousColumnCellAction());
     86
     87        setTransferHandler(new MemberTransferHandler());
     88        setFillsViewportHeight(true); // allow drop on empty table
     89        setDragEnabled(true);
     90        setDropMode(DropMode.INSERT_ROWS);
    8591    }
    8692
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r9266 r9368  
    447447    }
    448448
     449    void addMembersAtIndex(final Iterable<RelationMember> newMembers, final int index) {
     450        int idx = index;
     451        for (RelationMember member : newMembers) {
     452            members.add(idx++, member);
     453        }
     454        fireTableRowsInserted(index, idx - 1);
     455    }
     456
    449457    public void addMembersAtBeginning(List<? extends OsmPrimitive> primitives) {
    450458        addMembersAtIndex(primitives, 0);
Note: See TracChangeset for help on using the changeset viewer.