Package org.openstreetmap.josm.gui.layer
Class ValidatorLayer
- java.lang.Object
-
- org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
-
- org.openstreetmap.josm.gui.layer.Layer
-
- org.openstreetmap.josm.gui.layer.ValidatorLayer
-
- All Implemented Interfaces:
ProjectionChangeListener
,LayerManager.LayerChangeListener
,MapViewPaintable
,Destroyable
public class ValidatorLayer extends Layer implements LayerManager.LayerChangeListener
A layer showing error messages.- Since:
- 3669 (creation), 10386 (new LayerChangeListener interface)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.Layer
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
AbstractMapViewPaintable.CompatibilityModeLayerPainter
-
Nested classes/interfaces inherited from interface org.openstreetmap.josm.gui.layer.MapViewPaintable
MapViewPaintable.LayerPainter, MapViewPaintable.MapViewEvent, MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Runnable
invalidator
-
Fields inherited from class org.openstreetmap.josm.gui.layer.Layer
FILTER_STATE_PROP, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP
-
-
Constructor Summary
Constructors Constructor Description ValidatorLayer()
Constructs a new Validator layer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkSaveConditions()
Checks whether it is ok to launch a save (whether we have data, there is no conflict etc.)java.io.File
createAndOpenSaveFileChooser()
Creates a new "Save" dialog for this layer and makes it visible.void
destroy()
Called, when the layer is removed from the mapview and is going to be destroyed.LayerPositionStrategy
getDefaultLayerPosition()
Gets the strategy that specifies where this layer should be inserted in a layer list.javax.swing.Icon
getIcon()
Return a static icon.java.lang.Object
getInfoComponent()
Gets the layer information to display to the user.javax.swing.Action[]
getMenuEntries()
Returns list of actions.java.lang.String
getToolTipText()
Returns a small tooltip hint about some statistics for this layer.boolean
isMergable(Layer other)
Determines if the other layer can be merged into this layer.boolean
isSavable()
Replies the savable state of this layer (i.e., if it can be saved through a "File → Save" dialog).void
layerAdded(LayerManager.LayerAddEvent e)
Notifies this listener that a layer has been added.void
layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Notifies this listener that the order of layers was changed.void
layerRemoving(LayerManager.LayerRemoveEvent e)
If layer is the OSM Data layer, remove all errorsvoid
mergeFrom(Layer from)
Merges the given layer into this layer.void
paint(java.awt.Graphics2D g, MapView mv, Bounds bounds)
Draw all primitives in this layer but do not draw modified ones (they are drawn by the edit layer).void
visitBoundingBox(BoundingXYVisitor v)
Visits the content bounds of this layer.-
Methods inherited from class org.openstreetmap.josm.gui.layer.Layer
addPropertyChangeListener, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getChangesetSourceTag, getColor, getLabel, getName, getOpacity, getViewProjectionBounds, hasColor, hookUpMapView, isBackgroundLayer, isInfoResizable, isProjectionSupported, isRenamed, isVisible, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setColor, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible, toString
-
Methods inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
addInvalidationListener, attachToMapView, createMapViewPainter, invalidate, removeInvalidationListener
-
-
-
-
Field Detail
-
invalidator
private final java.lang.Runnable invalidator
-
-
Constructor Detail
-
ValidatorLayer
public ValidatorLayer()
Constructs a new Validator layer
-
-
Method Detail
-
getIcon
public javax.swing.Icon getIcon()
Return a static icon.
-
paint
public void paint(java.awt.Graphics2D g, MapView mv, Bounds bounds)
Draw all primitives in this layer but do not draw modified ones (they are drawn by the edit layer). Draw nodes last to overlap the ways they belong to.- Specified by:
paint
in interfaceMapViewPaintable
- Parameters:
g
- Graphicsmv
- The object that can translate GeoPoints to screen coordinates.bounds
- Bounding box
-
getToolTipText
public java.lang.String getToolTipText()
Description copied from class:Layer
Returns a small tooltip hint about some statistics for this layer.- Specified by:
getToolTipText
in classLayer
- Returns:
- A small tooltip hint about some statistics for this layer.
-
mergeFrom
public void mergeFrom(Layer from)
Description copied from class:Layer
Merges the given layer into this layer. Throws if the layer types are incompatible.
-
isMergable
public boolean isMergable(Layer other)
Description copied from class:Layer
Determines if the other layer can be merged into this layer.- Specified by:
isMergable
in classLayer
- Parameters:
other
- The other layer that is tested to be mergable with this.- Returns:
- Whether the other layer can be merged into this layer.
-
visitBoundingBox
public void visitBoundingBox(BoundingXYVisitor v)
Description copied from class:Layer
Visits the content bounds of this layer. The behavior of this method depends on the layer, but each implementation should attempt to cover the relevant content of the layer in this method.- Specified by:
visitBoundingBox
in classLayer
- Parameters:
v
- The visitor that gets notified about the contents of this layer.
-
getInfoComponent
public java.lang.Object getInfoComponent()
Description copied from class:Layer
Gets the layer information to display to the user. This is used if the user requests information about this layer. It should display a description of the layer content.- Specified by:
getInfoComponent
in classLayer
- Returns:
- Either a String or a
Component
describing the layer.
-
getMenuEntries
public javax.swing.Action[] getMenuEntries()
Description copied from class:Layer
Returns list of actions. Action can implement LayerAction interface when it needs to be represented by other menu component than JMenuItem or when it supports multiple layers. Actions that support multiple layers should also have correct equals implementation.Use
Layer.SeparatorLayerAction.INSTANCE
instead of new JSeparator- Specified by:
getMenuEntries
in classLayer
- Returns:
- menu actions for this layer
-
isSavable
public boolean isSavable()
Description copied from class:Layer
Replies the savable state of this layer (i.e., if it can be saved through a "File → Save" dialog).
-
checkSaveConditions
public boolean checkSaveConditions()
Description copied from class:Layer
Checks whether it is ok to launch a save (whether we have data, there is no conflict etc.)- Overrides:
checkSaveConditions
in classLayer
- Returns:
true
, if it is safe to save.
-
createAndOpenSaveFileChooser
public java.io.File createAndOpenSaveFileChooser()
Description copied from class:Layer
Creates a new "Save" dialog for this layer and makes it visible.When the user has chosen a file, checks the file extension, and confirms overwriting if needed.
- Overrides:
createAndOpenSaveFileChooser
in classLayer
- Returns:
- The output
File
- See Also:
SaveActionBase.createAndOpenSaveFileChooser(java.lang.String, org.openstreetmap.josm.actions.ExtensionFileFilter)
-
layerOrderChanged
public void layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Description copied from interface:LayerManager.LayerChangeListener
Notifies this listener that the order of layers was changed.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerOrderChanged
in interfaceLayerManager.LayerChangeListener
- Parameters:
e
- The order change event.
-
layerAdded
public void layerAdded(LayerManager.LayerAddEvent e)
Description copied from interface:LayerManager.LayerChangeListener
Notifies this listener that a layer has been added.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerAdded
in interfaceLayerManager.LayerChangeListener
- Parameters:
e
- The new added layer event
-
layerRemoving
public void layerRemoving(LayerManager.LayerRemoveEvent e)
If layer is the OSM Data layer, remove all errors- Specified by:
layerRemoving
in interfaceLayerManager.LayerChangeListener
- Parameters:
e
- The layer to be removed (as event)
-
getDefaultLayerPosition
public LayerPositionStrategy getDefaultLayerPosition()
Description copied from class:Layer
Gets the strategy that specifies where this layer should be inserted in a layer list.- Overrides:
getDefaultLayerPosition
in classLayer
- Returns:
- That strategy.
-
destroy
public void destroy()
Description copied from class:Layer
Called, when the layer is removed from the mapview and is going to be destroyed.This is because the Layer constructor cannot add itself safely as a listener to the layerlist dialog, because there may be no such dialog yet (loaded via command line parameter).
- Specified by:
destroy
in interfaceDestroyable
- Overrides:
destroy
in classLayer
-
-