001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.plugins.eventbus.gui;
003
004import java.util.EventObject;
005
006import org.openstreetmap.josm.actions.mapmode.MapMode;
007
008/**
009 * Event fired when the map mode changes.
010 */
011public class MapModeChangeEvent extends EventObject {
012
013    private static final long serialVersionUID = 1L;
014
015    private final MapMode oldMapMode;
016    private final MapMode newMapMode;
017
018    /**
019     * Constructs a new {@code MapModeChangeEvent}.
020     * @param source object on which the Event initially occurred
021     * @param oldMapMode old map mode
022     * @param newMapMode new map mode
023     */
024    public MapModeChangeEvent(Object source, MapMode oldMapMode, MapMode newMapMode) {
025        super(source);
026        this.oldMapMode = oldMapMode;
027        this.newMapMode = newMapMode;
028    }
029
030    /**
031     * Returns the old map mode.
032     * @return the old map mode
033     */
034    public final MapMode getOldMapMode() {
035        return oldMapMode;
036    }
037
038    /**
039     * Returns the new map mode.
040     * @return the new map mode
041     */
042    public final MapMode getNewMapMode() {
043        return newMapMode;
044    }
045}