public abstract class AbstractMapViewPaintable extends java.lang.Object implements MapViewPaintable
MapViewPaintable
and a default #attaModifier and Type | Class and Description |
---|---|
protected class |
AbstractMapViewPaintable.CompatibilityModeLayerPainter
This is the default implementation of the layer painter.
|
MapViewPaintable.LayerPainter, MapViewPaintable.MapViewEvent, MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.CopyOnWriteArrayList<MapViewPaintable.PaintableInvalidationListener> |
invalidationListeners
A list of invalidation listeners to call when this layer is invalidated.
|
Constructor and Description |
---|
AbstractMapViewPaintable() |
Modifier and Type | Method and Description |
---|---|
void |
addInvalidationListener(MapViewPaintable.PaintableInvalidationListener l)
Adds a new paintable invalidation listener.
|
MapViewPaintable.LayerPainter |
attachToMapView(MapViewPaintable.MapViewEvent event)
This method is called whenever this layer is added to a map view.
|
protected MapViewPaintable.LayerPainter |
createMapViewPainter(MapViewPaintable.MapViewEvent event)
Creates a new LayerPainter.
|
void |
invalidate()
This needs to be called whenever the content of this view was invalidated.
|
void |
removeInvalidationListener(MapViewPaintable.PaintableInvalidationListener l)
Removes an added paintable invalidation listener.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
paint
private final java.util.concurrent.CopyOnWriteArrayList<MapViewPaintable.PaintableInvalidationListener> invalidationListeners
public AbstractMapViewPaintable()
public MapViewPaintable.LayerPainter attachToMapView(MapViewPaintable.MapViewEvent event)
You need to return a painter here.
The MapViewPaintable.LayerPainter.detachFromMapView(org.openstreetmap.josm.gui.layer.MapViewPaintable.MapViewEvent)
method is called when the layer is removed
from that map view. You are free to reuse painters.
You should always call the super method. See createMapViewPainter(org.openstreetmap.josm.gui.layer.MapViewPaintable.MapViewEvent)
if you want to influence painter creation.
This replaces Layer.hookUpMapView()
in the long run.
event
- the event.protected MapViewPaintable.LayerPainter createMapViewPainter(MapViewPaintable.MapViewEvent event)
event
- The event that triggered the creation.public void addInvalidationListener(MapViewPaintable.PaintableInvalidationListener l)
MapViewPaintable
addInvalidationListener
in interface MapViewPaintable
l
- The listener to add.public void removeInvalidationListener(MapViewPaintable.PaintableInvalidationListener l)
MapViewPaintable
removeInvalidationListener
in interface MapViewPaintable
l
- The listener to remove.public void invalidate()