Class FileExporter
java.lang.Object
org.openstreetmap.josm.gui.io.importexport.FileExporter
- All Implemented Interfaces:
MainLayerManager.ActiveLayerChangeListener
- Direct Known Subclasses:
GeoJSONExporter,GpxExporter,NoteExporter,OsmExporter,ValidatorErrorExporter,WMSLayerExporter
public abstract class FileExporter
extends Object
implements MainLayerManager.ActiveLayerChangeListener
Abstract base class for file exporters - IO classes that save layers to a file.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanfinal ExtensionFileFilterthe ExtensionFileFilter filter used by this exporter -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFileExporter(ExtensionFileFilter filter) Constructs a newFileExporter. -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptFile(File pathname, Layer layer) Check if this exporter can export a certain layer to a certain file.voidCalled whenever the active or edit layer changed.voidexportData(File file, Layer layer) Execute the data export.voidexportDataQuiet(File file, Layer layer) Execute the data export without prompting the user.final booleanDetermines if this exporter has been canceled during export.final booleanReturns the enabled state of thisFileExporter.final voidsetCanceled(boolean canceled) Marks this exporter as canceled.final voidsetEnabled(boolean enabled) Sets the enabled state of theFileExporter.
-
Field Details
-
filter
the ExtensionFileFilter filter used by this exporter -
enabled
-
canceled
-
-
Constructor Details
-
FileExporter
Constructs a newFileExporter.- Parameters:
filter- The extension file filter
-
-
Method Details
-
acceptFile
Check if this exporter can export a certain layer to a certain file. Most exporters support just a single layer type.- Parameters:
pathname- the target file name (check file extension using thefilterlayer- the layer requested for export- Returns:
- true, if the exporter can handle the layer and filename is okay
-
exportData
Execute the data export. (To be overridden by subclasses.)- Parameters:
file- target filelayer- the layer to export- Throws:
IOException- in case of an IO error
-
exportDataQuiet
Execute the data export without prompting the user. (To be overridden by subclasses.)- Parameters:
file- target filelayer- the layer to export- Throws:
IOException- in case of an IO error- Since:
- 15496
-
isEnabled
Returns the enabled state of thisFileExporter. When enabled, it is listed and usable in "File → Save" dialogs.- Returns:
- true if this
FileExporteris enabled - Since:
- 5459
-
setEnabled
Sets the enabled state of theFileExporter. When enabled, it is listed and usable in "File → Save" dialogs.- Parameters:
enabled- true to enable thisFileExporter, false to disable it- Since:
- 5459
-
activeOrEditLayerChanged
Description copied from interface:MainLayerManager.ActiveLayerChangeListenerCalled whenever the active or edit layer changed.You can be sure that this layer is still contained in this set.
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
- Specified by:
activeOrEditLayerChangedin interfaceMainLayerManager.ActiveLayerChangeListener- Parameters:
e- The change event.
-
isCanceled
Determines if this exporter has been canceled during export.- Returns:
- true if this
FileExporterhas been canceled - Since:
- 6815
-
setCanceled
Marks this exporter as canceled.- Parameters:
canceled- true to mark this exporter as canceled,falseotherwise- Since:
- 6815
-