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.StringIS_DIRTY_SYMBOLstatic java.lang.StringREQUIRES_SAVE_TO_DISK_PROPProperty 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 protectedAbstractModifiableLayer(java.lang.String name)Constructs a newModifiableLayer.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanautosave(java.io.File file)Perform the autosave action for the layerAbstractIOTaskcreateUploadTask(ProgressMonitor monitor)Creates a newAbstractIOTaskfor uploading data.DatagetData()Get the data for the modifiable layerAbstractUploadDialoggetUploadDialog()Returns the upload dialog for this layer.booleanisDirty()Determines if this layer is "dirty", i.e.booleanisDownloadable()Determines if the layer is able to download data and implements theDownloadFromServerinterface.booleanisLocked()Determines if this is read-only/locked (thus it cannot be modified).abstract booleanisModified()Determines if data managed by this layer has been modified.booleanisUploadable()Determines if the layer is able to upload data and implements theUploadToServerinterface.booleanisUploadDiscouraged()Determines if upload of data managed by this layer is discouraged.booleanisUploadInProgress()Determines if upload of data managed by this layer is currently in progress.voidlock()Enables the read-only/locked mode.voidonPostSaveToFile()Initializes the layer after a successful save of data to a file.voidonPostUploadToServer()Initializes the layer after a successful upload to the server.booleanrequiresSaveToFile()Determines if the data managed by this layer needs to be saved to a file.booleanrequiresUploadToServer()Determines if the data managed by this layer needs to be uploaded to the server because it contains modified data.voidunlock()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:DownloadFromServerDetermines if the layer is able to download data and implements theDownloadFromServerinterface. A layer that implements theDownloadFromServerinterface must returntrue.- Specified by:
isDownloadablein interfaceDownloadFromServer- Returns:
trueif the layer is able to download data;false, otherwise
-
isUploadable
public boolean isUploadable()
Description copied from interface:UploadToServerDetermines if the layer is able to upload data and implements theUploadToServerinterface. A layer that implements theUploadToServerinterface must returntrue.- Specified by:
isUploadablein interfaceUploadToServer- Returns:
trueif the layer is able to upload data;false, otherwise
-
requiresUploadToServer
public boolean requiresUploadToServer()
Description copied from interface:UploadToServerDetermines if the data managed by this layer needs to be uploaded to the server because it contains modified data.- Specified by:
requiresUploadToServerin interfaceUploadToServer- Returns:
trueif 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:SaveToFileDetermines 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:
requiresSaveToFilein interfaceSaveToFile- Returns:
trueif the data managed by this layer needs to be saved to a file;false, otherwise
-
isUploadDiscouraged
public boolean isUploadDiscouraged()
Description copied from interface:UploadToServerDetermines if upload of data managed by this layer is discouraged. This feature allows to use "private" data layers.- Specified by:
isUploadDiscouragedin interfaceUploadToServer- Returns:
trueif 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:SaveToFileInitializes the layer after a successful save of data to a file.- Specified by:
onPostSaveToFilein interfaceSaveToFile
-
onPostUploadToServer
public void onPostUploadToServer()
Initializes the layer after a successful upload to the server.- Specified by:
onPostUploadToServerin interfaceUploadToServer
-
createUploadTask
public AbstractIOTask createUploadTask(ProgressMonitor monitor)
Description copied from interface:UploadToServerCreates a newAbstractIOTaskfor uploading data.- Specified by:
createUploadTaskin interfaceUploadToServer- Parameters:
monitor- The progress monitor- Returns:
- a new
AbstractIOTaskfor uploading data, ornullif not applicable
-
getUploadDialog
public AbstractUploadDialog getUploadDialog()
Description copied from interface:UploadToServerReturns the upload dialog for this layer.- Specified by:
getUploadDialogin interfaceUploadToServer- Returns:
- the upload dialog for this layer, or
nullif not applicable
-
isUploadInProgress
public boolean isUploadInProgress()
Description copied from interface:UploadToServerDetermines if upload of data managed by this layer is currently in progress.- Specified by:
isUploadInProgressin interfaceUploadToServer- Returns:
trueif upload is in progress
-
lock
public void lock()
Description copied from interface:LockableEnables the read-only/locked mode.
-
unlock
public void unlock()
Description copied from interface:LockableDisables the read-only/locked mode.
-
isLocked
public boolean isLocked()
Description copied from interface:LockableDetermines 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:
trueif the layer was successfully saved- Throws:
java.io.IOException- If there was an IO exception from saving- Since:
- 16548
-
-