public abstract class FileImporter extends java.lang.Object implements java.lang.Comparable<FileImporter>, MapView.LayerChangeListener
Modifier and Type | Field and Description |
---|---|
private boolean |
enabled |
ExtensionFileFilter |
filter
The extension file filter used to accept files.
|
Constructor and Description |
---|
FileImporter(ExtensionFileFilter filter)
Constructs a new
FileImporter with the given extension file filter. |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptFile(java.io.File pathname)
Determines if this file importer accepts the given file.
|
void |
activeLayerChange(Layer oldLayer,
Layer newLayer)
Notifies this listener that the active layer has changed.
|
int |
compareTo(FileImporter other) |
private static void |
displayCancel(java.lang.Throwable t) |
private static void |
displayError(java.io.File f,
java.lang.Exception e) |
double |
getPriority()
If multiple files (with multiple file formats) are selected,
they are opened in the order of their priorities.
|
void |
importData(java.io.File file,
ProgressMonitor progressMonitor)
Needs to be implemented if isBatchImporter() returns false.
|
void |
importData(java.util.List<java.io.File> files,
ProgressMonitor progressMonitor)
Needs to be implemented if isBatchImporter() returns true.
|
boolean |
importDataHandleExceptions(java.io.File f,
ProgressMonitor progressMonitor)
Wrapper to give meaningful output if things go wrong.
|
boolean |
importDataHandleExceptions(java.util.List<java.io.File> files,
ProgressMonitor progressMonitor) |
boolean |
isBatchImporter()
A batch importer is a file importer that prefers to read multiple files at the same time.
|
boolean |
isEnabled()
Returns the enabled state of this
FileImporter . |
void |
layerAdded(Layer newLayer)
Notifies this listener that a layer has been added.
|
void |
layerRemoved(Layer oldLayer)
Notifies this listener that a layer has been removed.
|
void |
setEnabled(boolean enabled)
Sets the enabled state of the
FileImporter . |
public final ExtensionFileFilter filter
private boolean enabled
public FileImporter(ExtensionFileFilter filter)
FileImporter
with the given extension file filter.filter
- The extension file filterpublic boolean acceptFile(java.io.File pathname)
pathname
- The file to testtrue
if this file importer accepts the given file, false
otherwisepublic boolean isBatchImporter()
true
if this importer is a batch importerpublic void importData(java.io.File file, ProgressMonitor progressMonitor) throws java.io.IOException, IllegalDataException
file
- file to importprogressMonitor
- progress monitorjava.io.IOException
- if any I/O error occursIllegalDataException
- if invalid data is readpublic void importData(java.util.List<java.io.File> files, ProgressMonitor progressMonitor) throws java.io.IOException, IllegalDataException
files
- files to importprogressMonitor
- progress monitorjava.io.IOException
- if any I/O error occursIllegalDataException
- if invalid data is readpublic boolean importDataHandleExceptions(java.io.File f, ProgressMonitor progressMonitor)
private static void displayError(java.io.File f, java.lang.Exception e)
private static void displayCancel(java.lang.Throwable t)
public boolean importDataHandleExceptions(java.util.List<java.io.File> files, ProgressMonitor progressMonitor)
public double getPriority()
public int compareTo(FileImporter other)
compareTo
in interface java.lang.Comparable<FileImporter>
public final boolean isEnabled()
FileImporter
. When enabled, it is listed and usable in "File->Open" dialog.FileImporter
is enabledpublic final void setEnabled(boolean enabled)
FileImporter
. When enabled, it is listed and usable in "File->Open" dialog.enabled
- true to enable this FileImporter
, false to disable itpublic void activeLayerChange(Layer oldLayer, Layer newLayer)
MapView.LayerChangeListener
activeLayerChange
in interface MapView.LayerChangeListener
oldLayer
- The previous active layernewLayer
- The new activer layerpublic void layerAdded(Layer newLayer)
MapView.LayerChangeListener
layerAdded
in interface MapView.LayerChangeListener
newLayer
- The new added layerpublic void layerRemoved(Layer oldLayer)
MapView.LayerChangeListener
layerRemoved
in interface MapView.LayerChangeListener
oldLayer
- The old removed layer