- Timestamp:
- 2010-01-23T10:22:15+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r2869 r2880 46 46 import org.openstreetmap.josm.gui.OsmPrimitivRenderer; 47 47 import org.openstreetmap.josm.gui.SideButton; 48 import org.openstreetmap.josm.gui.layer.Layer;49 48 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 50 49 import org.openstreetmap.josm.tools.ImageProvider; … … 56 55 * 57 56 */ 58 public final class ConflictDialog extends ToggleDialog implements MapView. LayerChangeListener, IConflictListener, SelectionChangedListener{57 public final class ConflictDialog extends ToggleDialog implements MapView.EditLayerChangeListener, IConflictListener, SelectionChangedListener{ 59 58 60 59 static public Color getColor() { … … 72 71 private ResolveAction actResolve; 73 72 private SelectAction actSelect; 74 75 private OsmDataLayer layer = null;76 73 77 74 /** … … 125 122 public void showNotify() { 126 123 DataSet.selListeners.add(this); 127 MapView.addLayerChangeListener(this); 124 MapView.addEditLayerChangeListener(this); 125 refreshView(); 128 126 } 129 127 130 128 @Override 131 129 public void hideNotify() { 132 MapView.remove LayerChangeListener(this);130 MapView.removeEditLayerChangeListener(this); 133 131 DataSet.selListeners.remove(this); 134 132 } … … 164 162 */ 165 163 public final void refreshView() { 164 OsmDataLayer editLayer = Main.main.getEditLayer(); 165 conflicts = editLayer == null?new ConflictCollection():editLayer.getConflicts(); 166 166 model.fireContentChanged(); 167 167 } … … 210 210 } 211 211 212 public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) { 213 if (oldLayer != null) { 214 oldLayer.getConflicts().removeConflictListener(this); 215 } 216 if (newLayer != null) { 217 newLayer.getConflicts().addConflictListener(this); 218 } 219 refreshView(); 220 } 221 222 212 223 /** 213 224 * replies the conflict collection currently held by this dialog; may be null … … 217 228 public ConflictCollection getConflicts() { 218 229 return conflicts; 219 }220 221 /**222 * invoked if the active {@see Layer} changes223 */224 public void activeLayerChange(Layer oldLayer, Layer newLayer) {225 if (oldLayer instanceof OsmDataLayer) {226 this.layer = (OsmDataLayer)oldLayer;227 this.layer.getConflicts().removeConflictListener(this);228 }229 this.layer = null;230 if (newLayer instanceof OsmDataLayer) {231 this.layer = (OsmDataLayer)newLayer;232 layer.getConflicts().addConflictListener(this);233 this.conflicts = layer.getConflicts();234 }235 refreshView();236 }237 238 public void layerAdded(Layer newLayer) {239 // ignore240 }241 242 public void layerRemoved(Layer oldLayer) {243 if (this.layer == oldLayer) {244 this.layer = null;245 refreshView();246 }247 230 } 248 231 … … 376 359 } 377 360 } 361 378 362 }
Note:
See TracChangeset
for help on using the changeset viewer.