Changeset 32289 in osm


Ignore:
Timestamp:
2016-06-16T23:22:00+02:00 (9 years ago)
Author:
donvip
Message:

fix warnings

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  
    1919import org.openstreetmap.josm.Main;
    2020import 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;
    2421import org.openstreetmap.josm.gui.SideButton;
    2522import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
    2623import org.openstreetmap.josm.gui.layer.Layer;
    27 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     24import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
     25import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    2826import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
    2927import org.openstreetmap.josm.plugins.opendata.core.layers.OdDataLayer;
     
    3230
    3331@SuppressWarnings("serial")
    34 public class OdDialog extends ToggleDialog implements LayerChangeListener, EditLayerChangeListener {
     32public class OdDialog extends ToggleDialog implements ActiveLayerChangeListener {
    3533
    3634    //private final SideButton selectButton;
     
    122120        createLayout(new JTree(treeModel), true, buttons);
    123121       
    124         MapView.addEditLayerChangeListener(this);
     122        Main.getLayerManager().addActiveLayerChangeListener(this);
    125123    }
    126    
     124
    127125    private void disableAllButtons() {
    128126        for (SideButton button : buttons) {
     
    132130
    133131    @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();
    140134        if (newLayer instanceof OdLayer) {
    141135            dataLayer = ((OdLayer) newLayer).getDataLayer();
     
    157151
    158152    @Override
    159     public void layerAdded(Layer newLayer) {
    160     }
    161 
    162     @Override
    163     public void layerRemoved(Layer oldLayer) {
    164     }
    165 
    166     @Override
    167153    public void destroy() {
    168154        super.destroy();
    169         MapView.removeLayerChangeListener(this);
    170         MapView.removeEditLayerChangeListener(this);
     155        Main.getLayerManager().removeActiveLayerChangeListener(this);
    171156    }
    172157
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/layers/OdDataLayer.java

    r32139 r32289  
    1616import org.openstreetmap.josm.data.osm.DataSet;
    1717import 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;
     18import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
     19import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
     20import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
     21import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
     22import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
     23import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    2124import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2225import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
     
    2932import org.openstreetmap.josm.tools.ImageProvider;
    3033
    31 public class OdDataLayer extends OsmDataLayer implements OdLayer, LayerChangeListener {
     34public class OdDataLayer extends OsmDataLayer implements OdLayer, LayerChangeListener, ActiveLayerChangeListener {
    3235
    3336    public OdDiffLayer diffLayer;
     
    5255            }
    5356        }
    54         MapView.addLayerChangeListener(this);
     57        Main.getLayerManager().addLayerChangeListener(this);
    5558    }
    5659   
     
    9295            final OdOsmDataLayer layer = new OdOsmDataLayer(this, dataSet, getName()+"/OSM");
    9396            addOsmLayer(layer);
    94             Main.map.mapView.setActiveLayer(osmLayer);
     97            Main.getLayerManager().setActiveLayer(osmLayer);
    9598            if (oapiReq != null) {
    9699                OsmDownloader.downloadOapi(oapiReq);
     
    104107
    105108    @Override
    106     public void activeLayerChange(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) {
    108111            this.handler.notifyActive();
    109112        }
     
    111114
    112115    @Override
    113     public void layerAdded(Layer newLayer) {
     116    public void layerAdded(LayerAddEvent e) {
    114117    }
    115118
    116119    @Override
    117     public void layerRemoved(Layer oldLayer) {
    118         if (oldLayer == this) {
     120    public void layerRemoving(LayerRemoveEvent e) {
     121        if (e.getRemovedLayer() == this) {
    119122            removeOsmLayer();
    120123            removeDiffLayer();
    121         } else if (oldLayer == osmLayer) {
     124        } else if (e.getRemovedLayer() == osmLayer) {
    122125            osmLayer = null;
    123         } else if (oldLayer == diffLayer) {
     126        } else if (e.getRemovedLayer() == diffLayer) {
    124127            diffLayer = null;
    125128        }
     129    }
     130
     131    @Override
     132    public void layerOrderChanged(LayerOrderChangeEvent e) {
    126133    }
    127134
     
    174181        final OdDiffLayer layer = new OdDiffLayer(this, getName()+"/Diff");
    175182        addDiffLayer(layer);
    176         Main.map.mapView.setActiveLayer(diffLayer);
     183        Main.getLayerManager().setActiveLayer(diffLayer);
    177184    }
    178185}
Note: See TracChangeset for help on using the changeset viewer.