- Timestamp:
- 2009-08-07T20:59:59+02:00 (15 years ago)
- 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 32 32 import javax.swing.AbstractAction; 33 33 import javax.swing.BorderFactory; 34 import javax.swing.DefaultListSelectionModel; 34 35 import javax.swing.JButton; 35 36 import javax.swing.JComponent; … … 57 58 import org.openstreetmap.josm.command.ChangeCommand; 58 59 import org.openstreetmap.josm.command.ConflictAddCommand; 60 import org.openstreetmap.josm.data.SelectionChangedListener; 59 61 import org.openstreetmap.josm.data.conflict.Conflict; 60 62 import org.openstreetmap.josm.data.osm.DataSet; … … 200 202 201 203 memberTableModel.setSelectedMembers(selectedMembers); 202 DataSet.selListeners.add(memberTableModel);203 204 } 204 205 … … 336 337 editor.setAutoCompletionList(acList); 337 338 338 memberTable.getSelectionModel().addListSelectionListener(new SelectionSynchronizer()); 339 SelectionSynchronizer synchronizer = new SelectionSynchronizer(); 340 memberTable.getSelectionModel().addListSelectionListener(synchronizer); 341 DataSet.selListeners.add(synchronizer); 339 342 memberTable.addMouseListener(new MemberTableDblClickAdapter()); 340 343 memberTableModel.addMemberModelListener(memberTable); … … 1451 1454 * Updates the selection in the current data set with the selected referers in 1452 1455 * in the member table. 1453 *1454 1456 */ 1455 class SelectionSynchronizer implements ListSelectionListener 1457 class SelectionSynchronizer implements ListSelectionListener, SelectionChangedListener{ 1456 1458 public void valueChanged(ListSelectionEvent e) { 1457 1459 if (e.getValueIsAdjusting()) … … 1464 1466 if (!memberTableModel.selectionsAreInSync()) { 1465 1467 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); 1466 1477 } 1467 1478 } … … 1550 1561 } 1551 1562 } 1552 1553 1554 1563 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r1916 r1920 27 27 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 28 28 29 public class MemberTableModel extends AbstractTableModel implements SelectionChangedListener{29 public class MemberTableModel extends AbstractTableModel { 30 30 31 31 private ArrayList<RelationMember> members; … … 514 514 if (Main.map == null || Main.map.mapView == null) return false; 515 515 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 another524 // layer525 if (!isActiveLayer()) return;526 selectMembersReferringTo(newSelection);527 516 } 528 517
Note:
See TracChangeset
for help on using the changeset viewer.