Ignore:
Timestamp:
2016-03-23T21:30:27+01:00 (10 years ago)
Author:
Don-vip
Message:

fix #12654 - Add layer invalidation listener (patch by michael2402)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/MapViewPaintable.java

    r9230 r10031  
    77import org.openstreetmap.josm.gui.MapView;
    88
     9/**
     10 * This is a component that can be painted on the map view.
     11 * <p>
     12 * You might want to extend {@link AbstractMapViewPaintable} to ease implementation of this.
     13 * <p>
     14 * That class allows you to listen to paintable change events. Those methods may be moved here some time in the future.
     15 */
    916public interface MapViewPaintable {
     17
     18    /**
     19     * This event is fired whenever the paintable got invalidated and needs repainting some time in the future.
     20     * <p>
     21     * Note: We might add an area in the future.
     22     *
     23     * @author Michael Zangl
     24     */
     25    class PaintableInvalidationEvent {
     26        private final MapViewPaintable paintable;
     27
     28        /**
     29         * Creates a new {@link PaintableInvalidationEvent}
     30         * @param paintable The paintable that is invalidated.
     31         */
     32        public PaintableInvalidationEvent(MapViewPaintable paintable) {
     33            super();
     34            this.paintable = paintable;
     35        }
     36
     37        /**
     38         * Gets the layer that was invalidated.
     39         * @return The layer.
     40         */
     41        public MapViewPaintable getLayer() {
     42            return paintable;
     43        }
     44
     45        @Override
     46        public String toString() {
     47            return "LayerInvalidationEvent [layer=" + paintable + "]";
     48        }
     49    }
     50
     51    /**
     52     * This is a listener that listens to {@link PaintableInvalidationEvent}s
     53     * @author Michael Zangl
     54     */
     55    interface PaintableInvalidationListener {
     56        /**
     57         * Called whenever a {@link PaintableInvalidationEvent} is fired. This might be called from any thread.
     58         * @param event The event
     59         */
     60        void paintablInvalidated(PaintableInvalidationEvent event);
     61    }
    1062
    1163    /**
Note: See TracChangeset for help on using the changeset viewer.