Changeset 10279 in josm


Ignore:
Timestamp:
2016-05-25T08:52:14+02:00 (3 years ago)
Author:
Don-vip
Message:

GSOC core rework - LayerManager, see #12863, rename LayerManagerWithActive to MainLayerManager

Location:
trunk
Files:
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r10271 r10279  
    9292import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;
    9393import org.openstreetmap.josm.gui.layer.Layer;
    94 import org.openstreetmap.josm.gui.layer.LayerManagerWithActive;
     94import org.openstreetmap.josm.gui.layer.MainLayerManager;
    9595import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    9696import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
     
    199199     * @since 10271
    200200     */
    201     private static final LayerManagerWithActive layerManager = new LayerManagerWithActive();
     201    private static final MainLayerManager layerManager = new MainLayerManager();
    202202
    203203    /**
     
    740740     * Returns the main layer manager that is used by the map view.
    741741     * @return The layer manager. The value returned will never change.
    742      * @since 10271
    743      */
    744     public static LayerManagerWithActive getLayerManager() {
     742     * @since 10279
     743     */
     744    public static MainLayerManager getLayerManager() {
    745745        return layerManager;
    746746    }
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r10277 r10279  
    6161import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
    6262import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
    63 import org.openstreetmap.josm.gui.layer.LayerManagerWithActive;
    64 import org.openstreetmap.josm.gui.layer.LayerManagerWithActive.ActiveLayerChangeEvent;
    65 import org.openstreetmap.josm.gui.layer.LayerManagerWithActive.ActiveLayerChangeListener;
     63import org.openstreetmap.josm.gui.layer.MainLayerManager;
     64import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
     65import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    6666import org.openstreetmap.josm.gui.layer.MapViewPaintable;
    6767import org.openstreetmap.josm.gui.layer.MapViewPaintable.PaintableInvalidationEvent;
     
    9191public class MapView extends NavigatableComponent
    9292implements PropertyChangeListener, PreferenceChangedListener, OsmDataLayer.LayerStateChangeListener,
    93 LayerManager.LayerChangeListener, LayerManagerWithActive.ActiveLayerChangeListener {
     93LayerManager.LayerChangeListener, MainLayerManager.ActiveLayerChangeListener {
    9494    /**
    9595     * Interface to notify listeners of a layer change.
     
    265265     * This class is an adapter for the old layer change interface.
    266266     * <p>
    267      * New implementations should use {@link org.openstreetmap.josm.gui.layer.LayerManagerWithActive.ActiveLayerChangeListener}
     267     * New implementations should use {@link org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener}
    268268     * @author Michael Zangl
    269269     * @since 10271
     
    438438     * A list of all layers currently loaded. If we support multiple map views, this list may be different for each of them.
    439439     */
    440     private final LayerManagerWithActive layerManager;
     440    private final MainLayerManager layerManager;
    441441
    442442    /**
     
    479479     * @param viewportData the initial viewport of the map. Can be null, then
    480480     * the viewport is derived from the layer data.
    481      */
    482     public MapView(LayerManagerWithActive layerManager, final JPanel contentPane, final ViewportData viewportData) {
     481     * @since 10279
     482     */
     483    public MapView(MainLayerManager layerManager, final JPanel contentPane, final ViewportData viewportData) {
    483484        this.layerManager = layerManager;
    484485        initialViewport = viewportData;
     
    632633     *
    633634     * @return the next active data layer
    634      * @deprecated now handled by {@link LayerManagerWithActive}
     635     * @deprecated now handled by {@link MainLayerManager}
    635636     */
    636637    @Deprecated
  • trunk/src/org/openstreetmap/josm/gui/layer/MainLayerManager.java

    r10277 r10279  
    1717 * The edit layer is an data layer that we currently work with.
    1818 * @author Michael Zangl
    19  * @since 10271
     19 * @since 10279
    2020 */
    21 public class LayerManagerWithActive extends LayerManager {
     21public class MainLayerManager extends LayerManager {
    2222    /**
    2323     * This listener listens to changes of the active or the edit layer.
     
    5353         * @param previousActiveLayer the previous active layer
    5454         */
    55         ActiveLayerChangeEvent(LayerManagerWithActive source, OsmDataLayer previousEditLayer,
     55        ActiveLayerChangeEvent(MainLayerManager source, OsmDataLayer previousEditLayer,
    5656                Layer previousActiveLayer) {
    5757            super(source);
     
    7777
    7878        @Override
    79         public LayerManagerWithActive getSource() {
    80             return (LayerManagerWithActive) super.getSource();
     79        public MainLayerManager getSource() {
     80            return (MainLayerManager) super.getSource();
    8181        }
    8282    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/MainLayerManagerTest.java

    r10278 r10279  
    1313import org.openstreetmap.josm.JOSMFixture;
    1414import org.openstreetmap.josm.data.osm.DataSet;
    15 import org.openstreetmap.josm.gui.layer.LayerManagerWithActive.ActiveLayerChangeEvent;
    16 import org.openstreetmap.josm.gui.layer.LayerManagerWithActive.ActiveLayerChangeListener;
     15import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
     16import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    1717import org.openstreetmap.josm.gui.util.GuiHelper;
    1818import org.openstreetmap.josm.tools.Predicates;
    1919
    2020/**
    21  * Tests {@link LayerManagerWithActive}
     21 * Tests {@link MainLayerManager}.
    2222 * @author Michael Zangl
    23  *
    2423 */
    25 public class LayerManagerWithActiveTest extends LayerManagerTest {
    26 
    27     private LayerManagerWithActive layerManagerWithActive;
     24public class MainLayerManagerTest extends LayerManagerTest {
     25
     26    private MainLayerManager layerManagerWithActive;
    2827
    2928    private class CapturingActiveLayerChangeListener implements ActiveLayerChangeListener {
     
    6463    @Before
    6564    public void setUp() {
    66         layerManager = layerManagerWithActive = new LayerManagerWithActive();
     65        layerManager = layerManagerWithActive = new MainLayerManager();
    6766    }
    6867
     
    137136
    138137    /**
    139      * Test if {@link LayerManagerWithActive#addActiveLayerChangeListener(ActiveLayerChangeListener)} prevents listener from beeing added twice.
     138     * Test if {@link MainLayerManager#addActiveLayerChangeListener(ActiveLayerChangeListener)} prevents listener from beeing added twice.
    140139     */
    141140    @Test(expected = IllegalArgumentException.class)
     
    147146
    148147    /**
    149      * Test if {@link LayerManagerWithActive#removeActiveLayerChangeListener(ActiveLayerChangeListener)} works.
     148     * Test if {@link MainLayerManager#removeActiveLayerChangeListener(ActiveLayerChangeListener)} works.
    150149     */
    151150    @Test
     
    165164
    166165    /**
    167      * Test if {@link LayerManagerWithActive#removeActiveLayerChangeListener(ActiveLayerChangeListener)} checks if listener is in list.
     166     * Test if {@link MainLayerManager#removeActiveLayerChangeListener(ActiveLayerChangeListener)} checks if listener is in list.
    168167     */
    169168    @Test(expected = IllegalArgumentException.class)
     
    173172
    174173    /**
    175      * Tests {@link LayerManagerWithActive#setActiveLayer(Layer)} and {@link LayerManagerWithActive#getActiveLayer()}.
     174     * Tests {@link MainLayerManager#setActiveLayer(Layer)} and {@link MainLayerManager#getActiveLayer()}.
    176175     * <p>
    177176     * Edit and active layer getters are also tested in {@link #testAddLayerSetsActiveLayer()}
     
    192191
    193192    /**
    194      * Tests {@link LayerManagerWithActive#getEditDataSet()}
     193     * Tests {@link MainLayerManager#getEditDataSet()}
    195194     */
    196195    @Test
     
    214213
    215214    /**
    216      * Tests {@link LayerManagerWithActive#getVisibleLayersInZOrder()}
     215     * Tests {@link MainLayerManager#getVisibleLayersInZOrder()}
    217216     */
    218217    @Test
Note: See TracChangeset for help on using the changeset viewer.