Changeset 1920 in josm for trunk


Ignore:
Timestamp:
2009-08-07T20:59:59+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3207: Highlighting members in relation editor is broken

Location:
trunk/src/org/openstreetmap/josm/gui/dialogs/relation
Files:
2 edited

Legend:

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

    r1916 r1920  
    3232import javax.swing.AbstractAction;
    3333import javax.swing.BorderFactory;
     34import javax.swing.DefaultListSelectionModel;
    3435import javax.swing.JButton;
    3536import javax.swing.JComponent;
     
    5758import org.openstreetmap.josm.command.ChangeCommand;
    5859import org.openstreetmap.josm.command.ConflictAddCommand;
     60import org.openstreetmap.josm.data.SelectionChangedListener;
    5961import org.openstreetmap.josm.data.conflict.Conflict;
    6062import org.openstreetmap.josm.data.osm.DataSet;
     
    200202
    201203        memberTableModel.setSelectedMembers(selectedMembers);
    202         DataSet.selListeners.add(memberTableModel);
    203204    }
    204205
     
    336337        editor.setAutoCompletionList(acList);
    337338
    338         memberTable.getSelectionModel().addListSelectionListener(new SelectionSynchronizer());
     339        SelectionSynchronizer synchronizer = new SelectionSynchronizer();
     340        memberTable.getSelectionModel().addListSelectionListener(synchronizer);
     341        DataSet.selListeners.add(synchronizer);
    339342        memberTable.addMouseListener(new MemberTableDblClickAdapter());
    340343        memberTableModel.addMemberModelListener(memberTable);
     
    14511454     * Updates the selection in the current data set with the selected referers in
    14521455     * in the member table.
    1453      *
    14541456     */
    1455     class SelectionSynchronizer implements ListSelectionListener {
     1457    class SelectionSynchronizer implements ListSelectionListener, SelectionChangedListener{
    14561458        public void valueChanged(ListSelectionEvent e) {
    14571459            if (e.getValueIsAdjusting())
     
    14641466            if (!memberTableModel.selectionsAreInSync()) {
    14651467                getLayer().data.setSelected(memberTableModel.getSelectedReferers());
     1468            }
     1469        }
     1470
     1471        public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
     1472            // ignore selection change events if they happen for a dataset in another
     1473            // layer
     1474            if (!memberTableModel.isActiveLayer()) return;
     1475            if (!memberTableModel.selectionsAreInSync()) {
     1476                memberTableModel.selectMembersReferringTo(newSelection);
    14661477            }
    14671478        }
     
    15501561        }
    15511562    }
    1552 
    1553 
    15541563}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r1916 r1920  
    2727import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2828
    29 public class MemberTableModel extends AbstractTableModel implements SelectionChangedListener{
     29public class MemberTableModel extends AbstractTableModel {
    3030
    3131    private ArrayList<RelationMember> members;
     
    514514        if (Main.map == null || Main.map.mapView == null) return false;
    515515        return Main.map.mapView.getActiveLayer() == layer;
    516     }
    517 
    518 
    519     /* ------------------------------------------------------------------------- */
    520     /* Interface SelectionChangedListener                                        */
    521     /* ------------------------------------------------------------------------- */
    522     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    523         // ignore selection change events if they happen for a dataset in another
    524         // layer
    525         if (!isActiveLayer()) return;
    526         selectMembersReferringTo(newSelection);
    527516    }
    528517
Note: See TracChangeset for help on using the changeset viewer.