Ignore:
Timestamp:
2017-05-15T14:14:40+02:00 (7 years ago)
Author:
michael2402
Message:

See #14120: Don't make gpx tracks depend on the isChanged method, use a listener based approach instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java

    r9949 r12156  
    4040     * Returns the number of times this track has been changed.
    4141     * @return Number of times this track has been changed. Always 0 for read-only tracks
     42     * @deprecated since 12156 Replaced by change listeners.
    4243     */
    43     int getUpdateCount();
     44    @Deprecated
     45    default int getUpdateCount() {
     46        // to allow removal
     47        return 0;
     48    }
     49
     50    /**
     51     * Add a listener that listens to changes in the GPX track.
     52     * @param l The listener
     53     */
     54    default void addListener(GpxTrackChangeListener l) {
     55        // nop
     56    }
     57
     58    /**
     59     * Remove a listener that listens to changes in the GPX track.
     60     * @param l The listener
     61     */
     62    default void removeListener(GpxTrackChangeListener l) {
     63        // nop
     64    }
     65
     66    /**
     67     * A listener that listens to GPX track changes.
     68     * @author Michael Zangl
     69     * @since 12156
     70     */
     71    @FunctionalInterface
     72    public interface GpxTrackChangeListener {
     73        /**
     74         * Called when the gpx data changed.
     75         * @param e The event
     76         */
     77        void gpxDataChanged(GpxTrackChangeEvent e);
     78    }
     79
     80    /**
     81     * A track change event for the current track.
     82     * @author Michael Zangl
     83     * @since 12156
     84     */
     85    class GpxTrackChangeEvent {
     86        private final GpxTrack source;
     87
     88        GpxTrackChangeEvent(GpxTrack source) {
     89            super();
     90            this.source = source;
     91        }
     92
     93        /**
     94         * Get the track that was changed.
     95         * @return The track.
     96         */
     97        public GpxTrack getSource() {
     98            return source;
     99        }
     100    }
    44101}
Note: See TracChangeset for help on using the changeset viewer.