- Timestamp:
- 2018-06-13T00:05:31+02:00 (6 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r13647 r13925 17 17 import org.openstreetmap.josm.Main; 18 18 import org.openstreetmap.josm.command.Command; 19 import org.openstreetmap.josm.data. SelectionChangedListener;19 import org.openstreetmap.josm.data.osm.DataSelectionListener; 20 20 import org.openstreetmap.josm.data.osm.DataSet; 21 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 22 import org.openstreetmap.josm.data.osm.OsmUtils; 23 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;24 23 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 25 24 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; … … 46 45 * layer/selection listeners that call {@link #updateEnabledState()} whenever the global context is changed. 47 46 * 48 * A JosmAction can register a {@link LayerChangeListener} and a {@link SelectionChangedListener}. Upon47 * A JosmAction can register a {@link LayerChangeListener} and a {@link DataSelectionListener}. Upon 49 48 * a layer change event or a selection change event it invokes {@link #updateEnabledState()}. 50 49 * Subclasses can override {@link #updateEnabledState()} in order to update the {@link #isEnabled()}-state … … 203 202 if (listenToSelectionChange()) { 204 203 selectionChangeAdapter = new SelectionChangeAdapter(); 205 SelectionEventManager.getInstance() 206 .addSelectionListener(selectionChangeAdapter, FireMode.IN_EDT_CONSOLIDATED); 204 SelectionEventManager.getInstance().addSelectionListenerForEdt(selectionChangeAdapter); 207 205 } 208 206 initEnabledState(); … … 220 218 /** 221 219 * Overwrite this if {@link #updateEnabledState()} should be called when the selection changed. Default is true. 222 * @return <code>true</code> if a {@link SelectionChangedListener} should be registered.220 * @return <code>true</code> if a {@link DataSelectionListener} should be registered. 223 221 * @since 10353 224 222 */ … … 237 235 } 238 236 if (selectionChangeAdapter != null) { 239 DataSet.removeSelectionListener(selectionChangeAdapter);237 SelectionEventManager.getInstance().removeSelectionListener(selectionChangeAdapter); 240 238 } 241 239 } … … 417 415 * Adapter for selection change events. Runs updateEnabledState() whenever the selection changed. 418 416 */ 419 protected class SelectionChangeAdapter implements SelectionChangedListener {420 @Override 421 public void selectionChanged( Collection<? extends OsmPrimitive> newSelection) {422 updateEnabledState( newSelection);417 protected class SelectionChangeAdapter implements DataSelectionListener { 418 @Override 419 public void selectionChanged(SelectionChangeEvent event) { 420 updateEnabledState(event.getSelection()); 423 421 } 424 422 -
trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java
r13512 r13925 29 29 import org.openstreetmap.josm.command.SequenceCommand; 30 30 import org.openstreetmap.josm.data.Bounds; 31 import org.openstreetmap.josm.data.SelectionChangedListener;32 31 import org.openstreetmap.josm.data.coor.EastNorth; 32 import org.openstreetmap.josm.data.osm.DataSelectionListener; 33 33 import org.openstreetmap.josm.data.osm.DataSet; 34 34 import org.openstreetmap.josm.data.osm.Node; … … 36 36 import org.openstreetmap.josm.data.osm.Way; 37 37 import org.openstreetmap.josm.data.osm.WaySegment; 38 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 38 39 import org.openstreetmap.josm.data.preferences.CachingProperty; 39 40 import org.openstreetmap.josm.data.preferences.IntegerProperty; … … 59 60 * @author Alexander Kachkaev <alexander@kachkaev.ru>, 2011 60 61 */ 61 public class ImproveWayAccuracyAction extends MapMode implements 62 SelectionChangedListener, ModifierExListener { 62 public class ImproveWayAccuracyAction extends MapMode implements DataSelectionListener, ModifierExListener { 63 63 64 64 private static final String CROSSHAIR = /* ICON(cursor/)*/ "crosshair"; … … 154 154 map.mapView.addMouseMotionListener(this); 155 155 map.mapView.addTemporaryLayer(temporaryLayer); 156 DataSet.addSelectionListener(this);156 SelectionEventManager.getInstance().addSelectionListener(this); 157 157 158 158 map.keyDetector.addModifierExListener(this); … … 172 172 map.mapView.removeMouseMotionListener(this); 173 173 map.mapView.removeTemporaryLayer(temporaryLayer); 174 DataSet.removeSelectionListener(this);174 SelectionEventManager.getInstance().removeSelectionListener(this); 175 175 176 176 map.keyDetector.removeModifierExListener(this); … … 368 368 369 369 @Override 370 public void selectionChanged( Collection<? extends OsmPrimitive> newSelection) {370 public void selectionChanged(SelectionChangeEvent event) { 371 371 if (selectionChangedBlocked) { 372 372 return; -
trunk/src/org/openstreetmap/josm/actions/relation/AddSelectionToRelations.java
r13611 r13925 13 13 import org.openstreetmap.josm.command.Command; 14 14 import org.openstreetmap.josm.command.SequenceCommand; 15 import org.openstreetmap.josm.data. SelectionChangedListener;15 import org.openstreetmap.josm.data.osm.DataSelectionListener; 16 16 import org.openstreetmap.josm.data.osm.DataSet; 17 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 28 28 * @since 5799 29 29 */ 30 public class AddSelectionToRelations extends AbstractRelationAction implements SelectionChangedListener {30 public class AddSelectionToRelations extends AbstractRelationAction implements DataSelectionListener { 31 31 /** 32 32 * Constructs a new <code>AddSelectionToRelation</code>. … … 69 69 } 70 70 71 @Override 72 public void selectionChanged(final Collection<? extends OsmPrimitive> newSelection) { 71 private void selectionChanged(final Collection<? extends OsmPrimitive> newSelection) { 73 72 GuiHelper.runInEDT(() -> setEnabled(newSelection != null && !newSelection.isEmpty() 74 73 && OsmUtils.isOsmCollectionEditable(relations))); 75 74 } 75 76 @Override 77 public void selectionChanged(SelectionChangeEvent event) { 78 selectionChanged(event.getSelection()); 79 } 76 80 } -
trunk/src/org/openstreetmap/josm/data/SelectionChangedListener.java
r12098 r13925 30 30 * Informs the listener that the selection in the dataset has changed. 31 31 * @param newSelection The new selection. 32 * @deprecated use {@link DataSelectionListener} instead 32 33 */ 34 @Deprecated 33 35 void selectionChanged(Collection<? extends OsmPrimitive> newSelection); 34 36 } -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r13916 r13925 548 548 * themselves for any dataset selection changes that occur, regardless of the current active 549 549 * dataset. (However, the selection does only change in the active layer) 550 */ 550 * @deprecated to be removed 551 */ 552 @Deprecated 551 553 private static final Collection<SelectionChangedListener> selListeners = new CopyOnWriteArrayList<>(); 552 554 … … 556 558 * @see #addSelectionListener(DataSelectionListener) 557 559 * @see SelectionEventManager#removeSelectionListener(SelectionChangedListener) 558 */ 560 * @deprecated Use {@link SelectionEventManager#addSelectionListener(DataSelectionListener)} instead 561 */ 562 @Deprecated 559 563 public static void addSelectionListener(SelectionChangedListener listener) { 560 564 ((CopyOnWriteArrayList<SelectionChangedListener>) selListeners).addIfAbsent(listener); … … 566 570 * @see #removeSelectionListener(DataSelectionListener) 567 571 * @see SelectionEventManager#removeSelectionListener(SelectionChangedListener) 568 */ 572 * @deprecated Use {@link SelectionEventManager#removeSelectionListener(DataSelectionListener)} instead 573 */ 574 @Deprecated 569 575 public static void removeSelectionListener(SelectionChangedListener listener) { 570 576 selListeners.remove(listener); 571 577 } 572 578 579 /** 580 * @deprecated to be removed 581 * @param currentSelection current selection 582 */ 583 @Deprecated 573 584 private static void fireSelectionChange(Collection<? extends OsmPrimitive> currentSelection) { 574 585 for (SelectionChangedListener l : selListeners) { -
trunk/src/org/openstreetmap/josm/data/osm/OsmData.java
r13916 r13925 11 11 import org.openstreetmap.josm.data.DataSource; 12 12 import org.openstreetmap.josm.data.ProjectionBounds; 13 import org.openstreetmap.josm.data.SelectionChangedListener;14 13 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 15 14 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; … … 398 397 /** 399 398 * Sets the current selection to the primitives in <code>selection</code> 400 * and notifies all {@link SelectionChangedListener}.399 * and notifies all {@link DataSelectionListener}. 401 400 * 402 401 * @param selection the selection … … 406 405 /** 407 406 * Sets the current selection to the primitives in <code>osm</code> 408 * and notifies all {@link SelectionChangedListener}.407 * and notifies all {@link DataSelectionListener}. 409 408 * 410 409 * @param osm the primitives to set. <code>null</code> values are ignored for now, but this may be removed in the future. … … 414 413 /** 415 414 * Adds the primitives in <code>selection</code> to the current selection 416 * and notifies all {@link SelectionChangedListener}.415 * and notifies all {@link DataSelectionListener}. 417 416 * 418 417 * @param selection the selection … … 422 421 /** 423 422 * Adds the primitives in <code>osm</code> to the current selection 424 * and notifies all {@link SelectionChangedListener}.423 * and notifies all {@link DataSelectionListener}. 425 424 * 426 425 * @param osm the primitives to add … … 449 448 * @param listener The listener. 450 449 * @see #removeSelectionListener(DataSelectionListener) 451 * @see SelectionEventManager#addSelectionListener(SelectionChangedListener, 452 * org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode) 450 * @see SelectionEventManager#addSelectionListener(DataSelectionListener) 453 451 * To add a global listener. 454 452 */ -
trunk/src/org/openstreetmap/josm/data/osm/event/SelectionEventManager.java
r13434 r13925 48 48 } 49 49 50 /** 51 * @deprecated to be removed 52 */ 53 @Deprecated 50 54 private static class OldListenerInfo implements ListenerInfo { 51 55 private final SelectionChangedListener listener; … … 130 134 * @param fireMode Set this to IN_EDT_CONSOLIDATED if you want the event to be fired in the EDT thread. 131 135 * Set it to IMMEDIATELY if you want the event to fire in the thread that caused the selection update. 132 */ 136 * @deprecated Use {@link #addSelectionListener(DataSelectionListener)} or {@link #addSelectionListenerForEdt(DataSelectionListener)} 137 */ 138 @Deprecated 133 139 public void addSelectionListener(SelectionChangedListener listener, FireMode fireMode) { 134 140 if (fireMode == FireMode.IN_EDT) { … … 163 169 * Unregisters a {@code SelectionChangedListener}. 164 170 * @param listener listener to remove 165 */ 171 * @deprecated use {@link #removeSelectionListener(DataSelectionListener)} 172 */ 173 @Deprecated 166 174 public void removeSelectionListener(SelectionChangedListener listener) { 167 175 remove(new OldListenerInfo(listener)); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/MultipolygonCache.java
r13082 r13925 10 10 11 11 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.data. SelectionChangedListener;12 import org.openstreetmap.josm.data.osm.DataSelectionListener; 13 13 import org.openstreetmap.josm.data.osm.DataSet; 14 14 import org.openstreetmap.josm.data.osm.Node; … … 23 23 import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent; 24 24 import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent; 25 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 25 26 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 26 27 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; … … 39 40 * @since 4623 40 41 */ 41 public final class MultipolygonCache implements DataSetListener, LayerChangeListener, ProjectionChangeListener, SelectionChangedListener {42 public final class MultipolygonCache implements DataSetListener, LayerChangeListener, ProjectionChangeListener, DataSelectionListener { 42 43 43 44 private static final MultipolygonCache INSTANCE = new MultipolygonCache(); … … 49 50 private MultipolygonCache() { 50 51 Main.addProjectionChangeListener(this); 51 DataSet.addSelectionListener(this);52 SelectionEventManager.getInstance().addSelectionListener(this); 52 53 MainApplication.getLayerManager().addLayerChangeListener(this); 53 54 } … … 294 295 295 296 @Override 296 public synchronized void selectionChanged( Collection<? extends OsmPrimitive> newSelection) {297 public synchronized void selectionChanged(SelectionChangeEvent event) { 297 298 298 299 for (Iterator<PolyData> it = selectedPolyData.iterator(); it.hasNext();) { … … 303 304 DataSet ds = null; 304 305 Collection<Map<Relation, Multipolygon>> maps = null; 305 for (OsmPrimitive p : newSelection) {306 for (OsmPrimitive p : event.getSelection()) { 306 307 if (p instanceof Way && p.getDataSet() != null) { 307 308 if (ds == null) { -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r13649 r13925 60 60 61 61 import org.openstreetmap.josm.Main; 62 import org.openstreetmap.josm.data.SelectionChangedListener;63 62 import org.openstreetmap.josm.data.SystemOfMeasurement; 64 63 import org.openstreetmap.josm.data.SystemOfMeasurement.SoMChangeListener; … … 68 67 import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat; 69 68 import org.openstreetmap.josm.data.coor.conversion.ProjectedCoordinateFormat; 69 import org.openstreetmap.josm.data.osm.DataSelectionListener; 70 70 import org.openstreetmap.josm.data.osm.DataSet; 71 71 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; … … 121 121 */ 122 122 public final class MapStatus extends JPanel implements 123 Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener, SelectionChangedListener, DataSetListener, ZoomChangeListener {123 Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener, DataSelectionListener, DataSetListener, ZoomChangeListener { 124 124 125 125 private final DecimalFormat DECIMAL_FORMAT = new DecimalFormat(Config.getPref().get("statusbar.decimal-format", "0.0")); … … 952 952 Config.getPref().addPreferenceChangeListener(this); 953 953 DatasetEventManager.getInstance().addDatasetListener(this, FireMode.IN_EDT); 954 SelectionEventManager.getInstance().addSelectionListener (this, FireMode.IN_EDT_CONSOLIDATED);954 SelectionEventManager.getInstance().addSelectionListenerForEdt(this); 955 955 956 956 mvComponentAdapter = new ComponentAdapter() { … … 1204 1204 1205 1205 @Override 1206 public void selectionChanged( Collection<? extends OsmPrimitive> newSelection) {1207 refreshDistText( newSelection);1206 public void selectionChanged(SelectionChangeEvent event) { 1207 refreshDistText(event.getSelection()); 1208 1208 } 1209 1209 -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r13852 r13925 61 61 import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent; 62 62 import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent; 63 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 63 64 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 64 65 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; … … 239 240 newAction.updateEnabledState(); 240 241 DatasetEventManager.getInstance().addDatasetListener(this, FireMode.IN_EDT); 241 DataSet.addSelectionListener(addSelectionToRelations);242 SelectionEventManager.getInstance().addSelectionListener(addSelectionToRelations); 242 243 dataChanged(null); 243 244 ExpertToggleAction.addExpertModeChangeListener(this); … … 251 252 MapView.removeZoomChangeListener(this); 252 253 DatasetEventManager.getInstance().removeDatasetListener(this); 253 DataSet.removeSelectionListener(addSelectionToRelations);254 SelectionEventManager.getInstance().removeSelectionListener(addSelectionToRelations); 254 255 ExpertToggleAction.removeExpertModeChangeListener(this); 255 256 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r13564 r13925 42 42 import org.openstreetmap.josm.actions.relation.EditRelationAction; 43 43 import org.openstreetmap.josm.actions.relation.SelectInRelationListAction; 44 import org.openstreetmap.josm.data. SelectionChangedListener;44 import org.openstreetmap.josm.data.osm.DataSelectionListener; 45 45 import org.openstreetmap.josm.data.osm.DataSet; 46 46 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; … … 65 65 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 66 66 import org.openstreetmap.josm.gui.MainApplication; 67 import org.openstreetmap.josm.gui.PopupMenuHandler; 67 68 import org.openstreetmap.josm.gui.PrimitiveRenderer; 68 import org.openstreetmap.josm.gui.PopupMenuHandler;69 69 import org.openstreetmap.josm.gui.SideButton; 70 70 import org.openstreetmap.josm.gui.datatransfer.PrimitiveTransferable; … … 165 165 @Override 166 166 public void showNotify() { 167 SelectionEventManager.getInstance().addSelectionListener (actShowHistory, FireMode.IN_EDT_CONSOLIDATED);168 SelectionEventManager.getInstance().addSelectionListener (model, FireMode.IN_EDT_CONSOLIDATED);167 SelectionEventManager.getInstance().addSelectionListenerForEdt(actShowHistory); 168 SelectionEventManager.getInstance().addSelectionListenerForEdt(model); 169 169 DatasetEventManager.getInstance().addDatasetListener(model, FireMode.IN_EDT); 170 170 MainApplication.getLayerManager().addActiveLayerChangeListener(actSearch); … … 339 339 * The action for showing history information of the current history item. 340 340 */ 341 class ShowHistoryAction extends AbstractAction implements ListSelectionListener, SelectionChangedListener {341 class ShowHistoryAction extends AbstractAction implements ListSelectionListener, DataSelectionListener { 342 342 /** 343 343 * Constructs a new {@code ShowHistoryAction}. … … 372 372 373 373 @Override 374 public void selectionChanged( Collection<? extends OsmPrimitive> newSelection) {375 updateEnabledState( newSelection.size());374 public void selectionChanged(SelectionChangeEvent event) { 375 updateEnabledState(event.getSelection().size()); 376 376 } 377 377 } … … 461 461 */ 462 462 static class SelectionListModel extends AbstractListModel<OsmPrimitive> 463 implements ActiveLayerChangeListener, SelectionChangedListener, DataSetListener {463 implements ActiveLayerChangeListener, DataSelectionListener, DataSetListener { 464 464 465 465 private static final int SELECTION_HISTORY_SIZE = 10; … … 673 673 674 674 /* ------------------------------------------------------------------------ */ 675 /* interface SelectionChangedListener*/675 /* interface DataSelectionListener */ 676 676 /* ------------------------------------------------------------------------ */ 677 677 @Override 678 public void selectionChanged( Collection<? extends OsmPrimitive> newSelection) {679 setJOSMSelection( newSelection);678 public void selectionChanged(SelectionChangeEvent event) { 679 setJOSMSelection(event.getSelection()); 680 680 } 681 681 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r13905 r13925 34 34 import org.openstreetmap.josm.actions.relation.EditRelationAction; 35 35 import org.openstreetmap.josm.command.Command; 36 import org.openstreetmap.josm.data. SelectionChangedListener;36 import org.openstreetmap.josm.data.osm.DataSelectionListener; 37 37 import org.openstreetmap.josm.data.osm.DataSet; 38 38 import org.openstreetmap.josm.data.osm.Node; 39 39 import org.openstreetmap.josm.data.osm.OsmPrimitive; 40 40 import org.openstreetmap.josm.data.osm.WaySegment; 41 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 41 42 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 42 43 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor; … … 72 73 * @author frsantos 73 74 */ 74 public class ValidatorDialog extends ToggleDialog implements SelectionChangedListener, ActiveLayerChangeListener {75 public class ValidatorDialog extends ToggleDialog implements DataSelectionListener, ActiveLayerChangeListener { 75 76 76 77 /** The display tree */ … … 181 182 @Override 182 183 public void showNotify() { 183 DataSet.addSelectionListener(this);184 SelectionEventManager.getInstance().addSelectionListener(this); 184 185 DataSet ds = MainApplication.getLayerManager().getActiveDataSet(); 185 186 if (ds != null) { … … 192 193 public void hideNotify() { 193 194 MainApplication.getLayerManager().removeActiveLayerChangeListener(this); 194 DataSet.removeSelectionListener(this);195 SelectionEventManager.getInstance().removeSelectionListener(this); 195 196 } 196 197 … … 585 586 586 587 @Override 587 public void selectionChanged( Collection<? extends OsmPrimitive> newSelection) {588 updateSelection( newSelection);588 public void selectionChanged(SelectionChangeEvent event) { 589 updateSelection(event.getSelection()); 589 590 } 590 591 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r13854 r13925 59 59 import org.openstreetmap.josm.command.ChangePropertyCommand; 60 60 import org.openstreetmap.josm.command.Command; 61 import org.openstreetmap.josm.data.SelectionChangedListener;62 61 import org.openstreetmap.josm.data.osm.AbstractPrimitive; 62 import org.openstreetmap.josm.data.osm.DataSelectionListener; 63 63 import org.openstreetmap.josm.data.osm.DataSet; 64 64 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; … … 124 124 */ 125 125 public class PropertiesDialog extends ToggleDialog 126 implements SelectionChangedListener, ActiveLayerChangeListener, DataSetListenerAdapter.Listener {126 implements DataSelectionListener, ActiveLayerChangeListener, DataSetListenerAdapter.Listener { 127 127 128 128 /** … … 512 512 public void showNotify() { 513 513 DatasetEventManager.getInstance().addDatasetListener(dataChangedAdapter, FireMode.IN_EDT_CONSOLIDATED); 514 SelectionEventManager.getInstance().addSelectionListener (this, FireMode.IN_EDT_CONSOLIDATED);514 SelectionEventManager.getInstance().addSelectionListenerForEdt(this); 515 515 MainApplication.getLayerManager().addActiveLayerChangeListener(this); 516 516 for (JosmAction action : josmActions) { … … 549 549 550 550 @Override 551 public void selectionChanged( Collection<? extends OsmPrimitive> newSelection) {551 public void selectionChanged(SelectionChangeEvent event) { 552 552 if (!isVisible()) 553 553 return; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r13434 r13925 21 21 import javax.swing.table.AbstractTableModel; 22 22 23 import org.openstreetmap.josm.data.SelectionChangedListener; 24 import org.openstreetmap.josm.data.osm.DataSet; 23 import org.openstreetmap.josm.data.osm.DataSelectionListener; 25 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; 26 25 import org.openstreetmap.josm.data.osm.Relation; … … 33 32 import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent; 34 33 import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent; 34 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 35 35 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 36 36 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; … … 53 53 */ 54 54 public class MemberTableModel extends AbstractTableModel 55 implements TableModelListener, SelectionChangedListener, DataSetListener, OsmPrimitivesTableModel {55 implements TableModelListener, DataSelectionListener, DataSetListener, OsmPrimitivesTableModel { 56 56 57 57 /** … … 97 97 */ 98 98 public void register() { 99 DataSet.addSelectionListener(this);99 SelectionEventManager.getInstance().addSelectionListener(this); 100 100 getLayer().data.addDataSetListener(this); 101 101 } … … 105 105 */ 106 106 public void unregister() { 107 DataSet.removeSelectionListener(this);107 SelectionEventManager.getInstance().removeSelectionListener(this); 108 108 getLayer().data.removeDataSetListener(this); 109 109 } 110 110 111 111 /* --------------------------------------------------------------------------- */ 112 /* Interface SelectionChangedListener*/112 /* Interface DataSelectionListener */ 113 113 /* --------------------------------------------------------------------------- */ 114 114 @Override 115 public void selectionChanged( Collection<? extends OsmPrimitive> newSelection) {115 public void selectionChanged(SelectionChangeEvent event) { 116 116 if (MainApplication.getLayerManager().getActiveDataLayer() != this.layer) return; 117 117 // just trigger a repaint -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableModel.java
r13434 r13925 7 7 import javax.swing.table.AbstractTableModel; 8 8 9 import org.openstreetmap.josm.data.SelectionChangedListener; 10 import org.openstreetmap.josm.data.osm.DataSet; 9 import org.openstreetmap.josm.data.osm.DataSelectionListener; 11 10 import org.openstreetmap.josm.data.osm.OsmPrimitive; 11 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 12 12 import org.openstreetmap.josm.gui.MainApplication; 13 13 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; … … 22 22 /** 23 23 * This table shows the primitives that are currently selected in the main OSM view. 24 * @since 1790 24 25 */ 25 public class SelectionTableModel extends AbstractTableModel implements SelectionChangedListener, ActiveLayerChangeListener, LayerChangeListener {26 public class SelectionTableModel extends AbstractTableModel implements DataSelectionListener, ActiveLayerChangeListener, LayerChangeListener { 26 27 27 28 /** this selection table model only displays selected primitives in this layer */ … … 46 47 */ 47 48 public void register() { 48 DataSet.addSelectionListener(this);49 SelectionEventManager.getInstance().addSelectionListener(this); 49 50 MainApplication.getLayerManager().addActiveLayerChangeListener(this); 50 51 } … … 54 55 */ 55 56 public void unregister() { 56 DataSet.removeSelectionListener(this);57 SelectionEventManager.getInstance().removeSelectionListener(this); 57 58 MainApplication.getLayerManager().removeActiveLayerChangeListener(this); 58 59 } … … 106 107 107 108 @Override 108 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 109 public void selectionChanged(SelectionChangeEvent event) { 110 selectionChanged(event.getSelection()); 111 } 112 113 private void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 109 114 if (layer == MainApplication.getLayerManager().getActiveDataLayer()) { 110 115 cache.clear(); … … 116 121 } 117 122 123 /** 124 * Returns the selected primitives. 125 * @return the selected primitives 126 */ 118 127 public List<OsmPrimitive> getSelection() { 119 128 return cache; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchDialog.java
r13069 r13925 7 7 8 8 import org.openstreetmap.josm.Main; 9 import org.openstreetmap.josm.data.osm. DataSet;9 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 10 10 import org.openstreetmap.josm.gui.ExtendedDialog; 11 11 … … 35 35 selector = new TaggingPresetSelector(true, true); 36 36 setContent(selector, false); 37 DataSet.addSelectionListener(selector);37 SelectionEventManager.getInstance().addSelectionListener(selector); 38 38 selector.setDblClickListener(e -> buttonAction(0, null)); 39 39 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java
r13836 r13925 35 35 36 36 import org.openstreetmap.josm.Main; 37 import org.openstreetmap.josm.data. SelectionChangedListener;37 import org.openstreetmap.josm.data.osm.DataSelectionListener; 38 38 import org.openstreetmap.josm.data.osm.DataSet; 39 39 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 53 53 * @since 6068 54 54 */ 55 public class TaggingPresetSelector extends SearchTextResultListPanel<TaggingPreset> implements SelectionChangedListener {55 public class TaggingPresetSelector extends SearchTextResultListPanel<TaggingPreset> implements DataSelectionListener { 56 56 57 57 private static final int CLASSIFICATION_IN_FAVORITES = 300; … … 370 370 371 371 @Override 372 public void selectionChanged( Collection<? extends OsmPrimitive> newSelection) {372 public void selectionChanged(SelectionChangeEvent event) { 373 373 typesInSelectionDirty = true; 374 374 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/SelectionEventManagerTest.java
r13616 r13925 27 27 * @since 12048 28 28 */ 29 @SuppressWarnings("deprecation") 29 30 public class SelectionEventManagerTest { 30 31 private final class SelectionListener implements SelectionChangedListener, DataSelectionListener {
Note:
See TracChangeset
for help on using the changeset viewer.