Changeset 32289 in osm for applications/editors/josm/plugins/opendata
- Timestamp:
- 2016-06-16T23:22:00+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/OdDialog.java
r30723 r32289 19 19 import org.openstreetmap.josm.Main; 20 20 import org.openstreetmap.josm.actions.JosmAction; 21 import org.openstreetmap.josm.gui.MapView;22 import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener;23 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;24 21 import org.openstreetmap.josm.gui.SideButton; 25 22 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 26 23 import org.openstreetmap.josm.gui.layer.Layer; 27 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 24 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; 25 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 28 26 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 29 27 import org.openstreetmap.josm.plugins.opendata.core.layers.OdDataLayer; … … 32 30 33 31 @SuppressWarnings("serial") 34 public class OdDialog extends ToggleDialog implements LayerChangeListener, EditLayerChangeListener {32 public class OdDialog extends ToggleDialog implements ActiveLayerChangeListener { 35 33 36 34 //private final SideButton selectButton; … … 122 120 createLayout(new JTree(treeModel), true, buttons); 123 121 124 Ma pView.addEditLayerChangeListener(this);122 Main.getLayerManager().addActiveLayerChangeListener(this); 125 123 } 126 124 127 125 private void disableAllButtons() { 128 126 for (SideButton button : buttons) { … … 132 130 133 131 @Override 134 public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) { 135 activeLayerChange(oldLayer, newLayer); 136 } 137 138 @Override 139 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 132 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 133 Layer newLayer = Main.getLayerManager().getActiveLayer(); 140 134 if (newLayer instanceof OdLayer) { 141 135 dataLayer = ((OdLayer) newLayer).getDataLayer(); … … 157 151 158 152 @Override 159 public void layerAdded(Layer newLayer) {160 }161 162 @Override163 public void layerRemoved(Layer oldLayer) {164 }165 166 @Override167 153 public void destroy() { 168 154 super.destroy(); 169 MapView.removeLayerChangeListener(this); 170 MapView.removeEditLayerChangeListener(this); 155 Main.getLayerManager().removeActiveLayerChangeListener(this); 171 156 } 172 157 -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/layers/OdDataLayer.java
r32139 r32289 16 16 import org.openstreetmap.josm.data.osm.DataSet; 17 17 import org.openstreetmap.josm.data.osm.Node; 18 import org.openstreetmap.josm.gui.MapView; 19 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; 20 import org.openstreetmap.josm.gui.layer.Layer; 18 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; 19 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener; 20 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent; 21 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 22 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; 23 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 21 24 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 22 25 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; … … 29 32 import org.openstreetmap.josm.tools.ImageProvider; 30 33 31 public class OdDataLayer extends OsmDataLayer implements OdLayer, LayerChangeListener {34 public class OdDataLayer extends OsmDataLayer implements OdLayer, LayerChangeListener, ActiveLayerChangeListener { 32 35 33 36 public OdDiffLayer diffLayer; … … 52 55 } 53 56 } 54 Ma pView.addLayerChangeListener(this);57 Main.getLayerManager().addLayerChangeListener(this); 55 58 } 56 59 … … 92 95 final OdOsmDataLayer layer = new OdOsmDataLayer(this, dataSet, getName()+"/OSM"); 93 96 addOsmLayer(layer); 94 Main. map.mapView.setActiveLayer(osmLayer);97 Main.getLayerManager().setActiveLayer(osmLayer); 95 98 if (oapiReq != null) { 96 99 OsmDownloader.downloadOapi(oapiReq); … … 104 107 105 108 @Override 106 public void active LayerChange(Layer oldLayer, Layer newLayer) {107 if ( newLayer== this && this.handler != null) {109 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 110 if (Main.getLayerManager().getActiveLayer() == this && this.handler != null) { 108 111 this.handler.notifyActive(); 109 112 } … … 111 114 112 115 @Override 113 public void layerAdded(Layer newLayer) {116 public void layerAdded(LayerAddEvent e) { 114 117 } 115 118 116 119 @Override 117 public void layerRemov ed(Layer oldLayer) {118 if ( oldLayer== this) {120 public void layerRemoving(LayerRemoveEvent e) { 121 if (e.getRemovedLayer() == this) { 119 122 removeOsmLayer(); 120 123 removeDiffLayer(); 121 } else if ( oldLayer== osmLayer) {124 } else if (e.getRemovedLayer() == osmLayer) { 122 125 osmLayer = null; 123 } else if ( oldLayer== diffLayer) {126 } else if (e.getRemovedLayer() == diffLayer) { 124 127 diffLayer = null; 125 128 } 129 } 130 131 @Override 132 public void layerOrderChanged(LayerOrderChangeEvent e) { 126 133 } 127 134 … … 174 181 final OdDiffLayer layer = new OdDiffLayer(this, getName()+"/Diff"); 175 182 addDiffLayer(layer); 176 Main. map.mapView.setActiveLayer(diffLayer);183 Main.getLayerManager().setActiveLayer(diffLayer); 177 184 } 178 185 }
Note:
See TracChangeset
for help on using the changeset viewer.