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.SeparatorLayerActionNested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
AbstractMapViewPaintable.CompatibilityModeLayerPainterNested classes/interfaces inherited from interface org.openstreetmap.josm.gui.layer.MapViewPaintable
MapViewPaintable.LayerPainter, MapViewPaintable.MapViewEvent, MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Stringstatic final StringProperty 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
ConstructorsModifierConstructorDescriptionprotectedConstructs a newModifiableLayer. -
Method Summary
Modifier and TypeMethodDescriptionbooleanPerform the autosave action for the layercreateUploadTask(ProgressMonitor monitor) Creates a newAbstractIOTaskfor uploading data.getData()Get the data for the modifiable layerReturns the upload dialog for this layer.booleanisDirty()Determines if this layer is "dirty", i.e.booleanDetermines 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 booleanDetermines if data managed by this layer has been modified.booleanDetermines if the layer is able to upload data and implements theUploadToServerinterface.booleanDetermines if upload of data managed by this layer is discouraged.booleanDetermines if upload of data managed by this layer is currently in progress.voidlock()Enables the read-only/locked mode.voidInitializes the layer after a successful save of data to a file.voidInitializes the layer after a successful upload to the server.booleanDetermines if the data managed by this layer needs to be saved to a file.booleanDetermines 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, visitBoundingBoxMethods inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
addInvalidationListener, attachToMapView, createMapViewPainter, invalidate, removeInvalidationListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.gui.layer.MapViewPaintable
paintMethods inherited from interface org.openstreetmap.josm.gui.layer.SaveToFile
isSavable
-
Field Details
-
REQUIRES_SAVE_TO_DISK_PROP
Property used to know if this layer has to be saved on disk.- Since:
- 18287
-
IS_DIRTY_SYMBOL
- See Also:
-
-
Constructor Details
-
AbstractModifiableLayer
Constructs a newModifiableLayer.- Parameters:
name- Layer name
-
-
Method Details
-
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
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
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
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
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
Determines if this layer is "dirty", i.e. requires save or upload- Returns:
- if this layer is "dirty"
- Since:
- 18287
-
isModified
Determines if data managed by this layer has been modified.- Returns:
- true if data has been modified; false, otherwise
-
onPostSaveToFile
Description copied from interface:SaveToFileInitializes the layer after a successful save of data to a file.- Specified by:
onPostSaveToFilein interfaceSaveToFile
-
onPostUploadToServer
Initializes the layer after a successful upload to the server.- Specified by:
onPostUploadToServerin interfaceUploadToServer
-
createUploadTask
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
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
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
Description copied from interface:LockableEnables the read-only/locked mode. -
unlock
Description copied from interface:LockableDisables the read-only/locked mode. -
isLocked
Description copied from interface:LockableDetermines if this is read-only/locked (thus it cannot be modified). -
autosave
Perform the autosave action for the layer- Parameters:
file- The file to save to- Returns:
trueif the layer was successfully saved- Throws:
IOException- If there was an IO exception from saving- Since:
- 16548
-
getData
Get the data for the modifiable layer- Returns:
- The data object
- Since:
- 16548
-