Package org.openstreetmap.josm.gui.io
Class SaveLayerInfo
- java.lang.Object
-
- org.openstreetmap.josm.gui.io.SaveLayerInfo
-
- All Implemented Interfaces:
java.lang.Comparable<SaveLayerInfo>
class SaveLayerInfo extends java.lang.Object implements java.lang.Comparable<SaveLayerInfo>
SaveLayerInfo represents the information, user preferences and save/upload states of a layer which might be uploaded/saved.- Since:
- 2025
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
doCheckSaveConditions
private boolean
doSaveToFile
private boolean
doUploadToServer
private java.io.File
file
private AbstractModifiableLayer
layer
the modifiable layerprivate UploadOrSaveState
saveState
private UploadOrSaveState
uploadState
-
Constructor Summary
Constructors Constructor Description SaveLayerInfo(AbstractModifiableLayer layer)
Constructs a newSaveLayerInfo
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(SaveLayerInfo o)
java.io.File
getFile()
Replies the file this layer should be saved to, ifisDoSaveToFile()
is trueAbstractModifiableLayer
getLayer()
Replies the layer this info objects holds information forjava.lang.String
getName()
Replies the name of the layerUploadOrSaveState
getSaveState()
Replies the save state ofgetLayer()
.UploadOrSaveState
getUploadState()
Replies the upload state ofgetLayer()
.boolean
isDoCheckSaveConditions()
Replies true if preconditions should be checked before saving; false, otherwiseboolean
isDoSaveAndUpload()
Replies true if this layer should be uploaded to the server and saved to file.boolean
isDoSaveToFile()
Replies true if this layer should be saved to a file; false, otherwiseboolean
isDoUploadToServer()
Replies true if this layer should be uploaded to the server; false, otherwiseboolean
isSavable()
Replies true if the layer can be saved to a fileboolean
isUploadable()
Replies true if the layer can be uploaded to a servervoid
resetUploadAndSaveState()
Resets the upload and save statevoid
setDoCheckSaveConditions(boolean doCheckSaveConditions)
Sets whether preconditions should be checked before savingvoid
setDoSaveToFile(boolean doSaveToFile)
Sets whether this layer should be saved to a filevoid
setDoUploadToServer(boolean doUploadToServer)
Sets whether this layer should be uploaded to a servervoid
setFile(java.io.File file)
Sets the file this layer should be saved to, ifisDoSaveToFile()
is truevoid
setSaveState(UploadOrSaveState saveState)
Sets the save state forgetLayer()
void
setUploadState(UploadOrSaveState uploadState)
Sets the upload state forgetLayer()
-
-
-
Field Detail
-
layer
private final AbstractModifiableLayer layer
the modifiable layer
-
doCheckSaveConditions
private boolean doCheckSaveConditions
-
doSaveToFile
private boolean doSaveToFile
-
doUploadToServer
private boolean doUploadToServer
-
file
private java.io.File file
-
uploadState
private UploadOrSaveState uploadState
-
saveState
private UploadOrSaveState saveState
-
-
Constructor Detail
-
SaveLayerInfo
SaveLayerInfo(AbstractModifiableLayer layer)
Constructs a newSaveLayerInfo
.- Parameters:
layer
- the layer. Must not be null.- Throws:
java.lang.IllegalArgumentException
- if layer is null
-
-
Method Detail
-
getLayer
public AbstractModifiableLayer getLayer()
Replies the layer this info objects holds information for- Returns:
- the layer this info objects holds information for
-
isSavable
public boolean isSavable()
Replies true if the layer can be saved to a file- Returns:
true
if the layer can be saved to a file;false
otherwise
-
isUploadable
public boolean isUploadable()
Replies true if the layer can be uploaded to a server- Returns:
true
if the layer can be uploaded to a server;false
otherwise
-
isDoCheckSaveConditions
public boolean isDoCheckSaveConditions()
Replies true if preconditions should be checked before saving; false, otherwise- Returns:
- true if preconditions should be checked before saving; false, otherwise
- Since:
- 7204
-
setDoCheckSaveConditions
public void setDoCheckSaveConditions(boolean doCheckSaveConditions)
Sets whether preconditions should be checked before saving- Parameters:
doCheckSaveConditions
- true to check save preconditions; false, to skip checking- Since:
- 7204
-
isDoSaveToFile
public boolean isDoSaveToFile()
Replies true if this layer should be saved to a file; false, otherwise- Returns:
- true if this layers should be saved to a file; false, otherwise
-
setDoSaveToFile
public void setDoSaveToFile(boolean doSaveToFile)
Sets whether this layer should be saved to a file- Parameters:
doSaveToFile
- true to save; false, to skip saving
-
isDoUploadToServer
public boolean isDoUploadToServer()
Replies true if this layer should be uploaded to the server; false, otherwise- Returns:
true
if this layer should be uploaded to the server;false
, otherwise
-
setDoUploadToServer
public void setDoUploadToServer(boolean doUploadToServer)
Sets whether this layer should be uploaded to a server- Parameters:
doUploadToServer
-true
to upload;false
, to skip uploading
-
isDoSaveAndUpload
public boolean isDoSaveAndUpload()
Replies true if this layer should be uploaded to the server and saved to file.- Returns:
- true if this layer should be uploaded to the server and saved to file
-
getName
public java.lang.String getName()
Replies the name of the layer- Returns:
- the name of the layer
-
getFile
public java.io.File getFile()
Replies the file this layer should be saved to, ifisDoSaveToFile()
is true- Returns:
- the file this layer should be saved to, if
isDoSaveToFile()
is true
-
setFile
public void setFile(java.io.File file)
Sets the file this layer should be saved to, ifisDoSaveToFile()
is true- Parameters:
file
- the file
-
compareTo
public int compareTo(SaveLayerInfo o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<SaveLayerInfo>
-
getUploadState
public UploadOrSaveState getUploadState()
Replies the upload state ofgetLayer()
.UploadOrSaveState.OK
ifgetLayer()
was successfully uploadedUploadOrSaveState.CANCELED
if uploadinggetLayer()
was canceledUploadOrSaveState.FAILED
if uploadinggetLayer()
has failed
- Returns:
- the upload state
-
setUploadState
public void setUploadState(UploadOrSaveState uploadState)
Sets the upload state forgetLayer()
- Parameters:
uploadState
- the upload state
-
getSaveState
public UploadOrSaveState getSaveState()
Replies the save state ofgetLayer()
.UploadOrSaveState.OK
ifgetLayer()
was successfully saved to fileUploadOrSaveState.CANCELED
if savinggetLayer()
was canceledUploadOrSaveState.FAILED
if savinggetLayer()
has failed
- Returns:
- the save state
-
setSaveState
public void setSaveState(UploadOrSaveState saveState)
Sets the save state forgetLayer()
- Parameters:
saveState
- save the upload state
-
resetUploadAndSaveState
public void resetUploadAndSaveState()
Resets the upload and save state
-
-