Package org.openstreetmap.josm.gui.layer
Class AbstractModifiableLayer
- java.lang.Object
-
- org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
-
- org.openstreetmap.josm.gui.layer.Layer
-
- org.openstreetmap.josm.gui.layer.AbstractModifiableLayer
-
- All Implemented Interfaces:
Lockable
,ProjectionChangeListener
,DownloadFromServer
,MapViewPaintable
,SaveToFile
,UploadToServer
,Destroyable
- Direct Known Subclasses:
AbstractOsmDataLayer
,GeoImageLayer
,GpxLayer
,GpxRouteLayer
,NoteLayer
public abstract class AbstractModifiableLayer extends Layer implements DownloadFromServer, UploadToServer, SaveToFile, Lockable
A modifiable layer.- Since:
- 7358
-
-
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 (package private) static java.lang.String
IS_DIRTY_SYMBOL
static java.lang.String
REQUIRES_SAVE_TO_DISK_PROP
Property used to know if this layer has to be saved on disk.-
Fields inherited from class org.openstreetmap.josm.gui.layer.Layer
FILTER_STATE_PROP, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractModifiableLayer(java.lang.String name)
Constructs a newModifiableLayer
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
autosave(java.io.File file)
Perform the autosave action for the layerAbstractIOTask
createUploadTask(ProgressMonitor monitor)
Creates a newAbstractIOTask
for uploading data.Data
getData()
Get the data for the modifiable layerAbstractUploadDialog
getUploadDialog()
Returns the upload dialog for this layer.boolean
isDirty()
Determines if this layer is "dirty", i.e.boolean
isDownloadable()
Determines if the layer is able to download data and implements theDownloadFromServer
interface.boolean
isLocked()
Determines if this is read-only/locked (thus it cannot be modified).abstract boolean
isModified()
Determines if data managed by this layer has been modified.boolean
isUploadable()
Determines if the layer is able to upload data and implements theUploadToServer
interface.boolean
isUploadDiscouraged()
Determines if upload of data managed by this layer is discouraged.boolean
isUploadInProgress()
Determines if upload of data managed by this layer is currently in progress.void
lock()
Enables the read-only/locked mode.void
onPostSaveToFile()
Initializes the layer after a successful save of data to a file.void
onPostUploadToServer()
Initializes the layer after a successful upload to the server.boolean
requiresSaveToFile()
Determines if the data managed by this layer needs to be saved to a file.boolean
requiresUploadToServer()
Determines if the data managed by this layer needs to be uploaded to the server because it contains modified data.void
unlock()
Disables the read-only/locked mode.-
Methods inherited from class org.openstreetmap.josm.gui.layer.Layer
addPropertyChangeListener, checkSaveConditions, createAndOpenSaveFileChooser, destroy, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getChangesetSourceTag, getColor, getDefaultLayerPosition, getIcon, getInfoComponent, getLabel, getMenuEntries, getName, getOpacity, getToolTipText, getViewProjectionBounds, hasColor, hookUpMapView, isBackgroundLayer, isInfoResizable, isMergable, isProjectionSupported, isRenamed, isSavable, isVisible, mergeFrom, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setColor, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible, toString, visitBoundingBox
-
Methods inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
addInvalidationListener, attachToMapView, createMapViewPainter, invalidate, removeInvalidationListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.gui.layer.MapViewPaintable
paint
-
Methods inherited from interface org.openstreetmap.josm.gui.layer.SaveToFile
isSavable
-
-
-
-
Field Detail
-
REQUIRES_SAVE_TO_DISK_PROP
public static final java.lang.String REQUIRES_SAVE_TO_DISK_PROP
Property used to know if this layer has to be saved on disk.- Since:
- 18287
-
IS_DIRTY_SYMBOL
static final java.lang.String IS_DIRTY_SYMBOL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractModifiableLayer
protected AbstractModifiableLayer(java.lang.String name)
Constructs a newModifiableLayer
.- Parameters:
name
- Layer name
-
-
Method Detail
-
isDownloadable
public boolean isDownloadable()
Description copied from interface:DownloadFromServer
Determines if the layer is able to download data and implements theDownloadFromServer
interface. A layer that implements theDownloadFromServer
interface must returntrue
.- Specified by:
isDownloadable
in interfaceDownloadFromServer
- Returns:
true
if the layer is able to download data;false
, otherwise
-
isUploadable
public boolean isUploadable()
Description copied from interface:UploadToServer
Determines if the layer is able to upload data and implements theUploadToServer
interface. A layer that implements theUploadToServer
interface must returntrue
.- Specified by:
isUploadable
in interfaceUploadToServer
- Returns:
true
if the layer is able to upload data;false
, otherwise
-
requiresUploadToServer
public boolean requiresUploadToServer()
Description copied from interface:UploadToServer
Determines if the data managed by this layer needs to be uploaded to the server because it contains modified data.- Specified by:
requiresUploadToServer
in interfaceUploadToServer
- Returns:
true
if the data managed by this layer needs to be uploaded to the server because it contains modified data;false
, otherwise
-
requiresSaveToFile
public boolean requiresSaveToFile()
Description copied from interface:SaveToFile
Determines if the data managed by this layer needs to be saved to a file. Only replies true if a file is assigned to this layer and if the data managed by this layer has been modified since the last save operation to the file.- Specified by:
requiresSaveToFile
in interfaceSaveToFile
- Returns:
true
if the data managed by this layer needs to be saved to a file;false
, otherwise
-
isUploadDiscouraged
public boolean isUploadDiscouraged()
Description copied from interface:UploadToServer
Determines if upload of data managed by this layer is discouraged. This feature allows to use "private" data layers.- Specified by:
isUploadDiscouraged
in interfaceUploadToServer
- Returns:
true
if upload is discouraged for this layer;false
, otherwise
-
isDirty
public boolean isDirty()
Determines if this layer is "dirty", i.e. requires save or upload- Returns:
- if this layer is "dirty"
- Since:
- 18287
-
isModified
public abstract boolean isModified()
Determines if data managed by this layer has been modified.- Returns:
- true if data has been modified; false, otherwise
-
onPostSaveToFile
public void onPostSaveToFile()
Description copied from interface:SaveToFile
Initializes the layer after a successful save of data to a file.- Specified by:
onPostSaveToFile
in interfaceSaveToFile
-
onPostUploadToServer
public void onPostUploadToServer()
Initializes the layer after a successful upload to the server.- Specified by:
onPostUploadToServer
in interfaceUploadToServer
-
createUploadTask
public AbstractIOTask createUploadTask(ProgressMonitor monitor)
Description copied from interface:UploadToServer
Creates a newAbstractIOTask
for uploading data.- Specified by:
createUploadTask
in interfaceUploadToServer
- Parameters:
monitor
- The progress monitor- Returns:
- a new
AbstractIOTask
for uploading data, ornull
if not applicable
-
getUploadDialog
public AbstractUploadDialog getUploadDialog()
Description copied from interface:UploadToServer
Returns the upload dialog for this layer.- Specified by:
getUploadDialog
in interfaceUploadToServer
- Returns:
- the upload dialog for this layer, or
null
if not applicable
-
isUploadInProgress
public boolean isUploadInProgress()
Description copied from interface:UploadToServer
Determines if upload of data managed by this layer is currently in progress.- Specified by:
isUploadInProgress
in interfaceUploadToServer
- Returns:
true
if upload is in progress
-
lock
public void lock()
Description copied from interface:Lockable
Enables the read-only/locked mode.
-
unlock
public void unlock()
Description copied from interface:Lockable
Disables the read-only/locked mode.
-
isLocked
public boolean isLocked()
Description copied from interface:Lockable
Determines if this is read-only/locked (thus it cannot be modified).
-
autosave
public boolean autosave(java.io.File file) throws java.io.IOException
Perform the autosave action for the layer- Parameters:
file
- The file to save to- Returns:
true
if the layer was successfully saved- Throws:
java.io.IOException
- If there was an IO exception from saving- Since:
- 16548
-
-