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 booleandoCheckSaveConditionsprivate booleandoSaveToFileprivate booleandoUploadToServerprivate java.io.Filefileprivate AbstractModifiableLayerlayerthe modifiable layerprivate UploadOrSaveStatesaveStateprivate UploadOrSaveStateuploadState
-
Constructor Summary
Constructors Constructor Description SaveLayerInfo(AbstractModifiableLayer layer)Constructs a newSaveLayerInfo.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(SaveLayerInfo o)java.io.FilegetFile()Replies the file this layer should be saved to, ifisDoSaveToFile()is trueAbstractModifiableLayergetLayer()Replies the layer this info objects holds information forjava.lang.StringgetName()Replies the name of the layerUploadOrSaveStategetSaveState()Replies the save state ofgetLayer().UploadOrSaveStategetUploadState()Replies the upload state ofgetLayer().booleanisDoCheckSaveConditions()Replies true if preconditions should be checked before saving; false, otherwisebooleanisDoSaveAndUpload()Replies true if this layer should be uploaded to the server and saved to file.booleanisDoSaveToFile()Replies true if this layer should be saved to a file; false, otherwisebooleanisDoUploadToServer()Replies true if this layer should be uploaded to the server; false, otherwisebooleanisSavable()Replies true if the layer can be saved to a filebooleanisUploadable()Replies true if the layer can be uploaded to a servervoidresetUploadAndSaveState()Resets the upload and save statevoidsetDoCheckSaveConditions(boolean doCheckSaveConditions)Sets whether preconditions should be checked before savingvoidsetDoSaveToFile(boolean doSaveToFile)Sets whether this layer should be saved to a filevoidsetDoUploadToServer(boolean doUploadToServer)Sets whether this layer should be uploaded to a servervoidsetFile(java.io.File file)Sets the file this layer should be saved to, ifisDoSaveToFile()is truevoidsetSaveState(UploadOrSaveState saveState)Sets the save state forgetLayer()voidsetUploadState(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:
trueif the layer can be saved to a file;falseotherwise
-
isUploadable
public boolean isUploadable()
Replies true if the layer can be uploaded to a server- Returns:
trueif the layer can be uploaded to a server;falseotherwise
-
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:
trueif 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-trueto 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:
compareToin interfacejava.lang.Comparable<SaveLayerInfo>
-
getUploadState
public UploadOrSaveState getUploadState()
Replies the upload state ofgetLayer().UploadOrSaveState.OKifgetLayer()was successfully uploadedUploadOrSaveState.CANCELEDif uploadinggetLayer()was canceledUploadOrSaveState.FAILEDif 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.OKifgetLayer()was successfully saved to fileUploadOrSaveState.CANCELEDif savinggetLayer()was canceledUploadOrSaveState.FAILEDif 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
-
-